|
|
|
@ -10,28 +10,48 @@ get_image() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do_install_detail() {
|
|
|
|
|
local config port IMAGE_NAME username password LAN_IP
|
|
|
|
|
local config port IMAGE_NAME LAN_IP
|
|
|
|
|
local usbcoral hwaccel storage mqtt host coral type device
|
|
|
|
|
|
|
|
|
|
port=$(uci get frigate.@frigate_config[0].port 2>/dev/null)
|
|
|
|
|
IMAGE_NAME=$(uci get frigate.@frigate_config[0].image 2>/dev/null)
|
|
|
|
|
usbcoral=$(uci get frigate.@frigate_config[0].usbcoral 2>/dev/null)
|
|
|
|
|
hwaccel=$(uci get frigate.@frigate_config[0].hwaccel 2>/dev/null)
|
|
|
|
|
storage=$(uci get frigate.@frigate_config[0].storage 2>/dev/null)
|
|
|
|
|
echo "Fetching port from configuration..."
|
|
|
|
|
port=$(uci get frigate.docker.port 2>/dev/null)
|
|
|
|
|
[ -z "$port" ] && { echo "Error: Port not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
mqtt=$(uci get frigate.@frigate_config[0].mqtt 2>/dev/null)
|
|
|
|
|
host=$(uci get frigate.@frigate_config[0].host 2>/dev/null)
|
|
|
|
|
echo "Fetching image name from configuration..."
|
|
|
|
|
IMAGE_NAME=$(uci get frigate.docker.image 2>/dev/null)
|
|
|
|
|
[ -z "$IMAGE_NAME" ] && { echo "Error: Image name not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
coral=$(uci get frigate.@frigate_config[0].coral 2>/dev/null)
|
|
|
|
|
type=$(uci get frigate.@frigate_config[0].type 2>/dev/null)
|
|
|
|
|
device=$(uci get frigate.@frigate_config[0].device 2>/dev/null)
|
|
|
|
|
echo "Fetching USB Coral path from configuration..."
|
|
|
|
|
usbcoral=$(uci get frigate.docker.usbcoral 2>/dev/null)
|
|
|
|
|
[ -z "$usbcoral" ] && { echo "Error: USB Coral path not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
username=$(uci get frigate.@frigate_config[0].username 2>/dev/null)
|
|
|
|
|
password=$(uci get frigate.@frigate_config[0].password 2>/dev/null)
|
|
|
|
|
APP_NAME="frigate"
|
|
|
|
|
echo "Fetching hardware acceleration path from configuration..."
|
|
|
|
|
hwaccel=$(uci get frigate.docker.hwaccel 2>/dev/null)
|
|
|
|
|
[ -z "$hwaccel" ] && { echo "Error: Hardware acceleration path not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
echo "Fetching storage path from configuration..."
|
|
|
|
|
storage=$(uci get frigate.docker.storage 2>/dev/null)
|
|
|
|
|
[ -z "$storage" ] && { echo "Error: Storage path not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
echo "Fetching MQTT status from configuration..."
|
|
|
|
|
mqtt=$(uci get frigate.mqtt.enabled 2>/dev/null)
|
|
|
|
|
[ -z "$mqtt" ] && { echo "Error: MQTT status not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
echo "Fetching MQTT host from configuration..."
|
|
|
|
|
host=$(uci get frigate.mqtt.host 2>/dev/null)
|
|
|
|
|
[ -z "$host" ] && { echo "Error: MQTT host not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
GEN_PASS=$(< /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c 14; echo)
|
|
|
|
|
GEN_PASS2=$(< /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c 14; echo)
|
|
|
|
|
echo "Fetching Coral status from configuration..."
|
|
|
|
|
coral=$(uci get frigate.detectors.coral 2>/dev/null)
|
|
|
|
|
[ -z "$coral" ] && { echo "Error: Coral status not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
echo "Fetching Coral type from configuration..."
|
|
|
|
|
type=$(uci get frigate.detectors.type 2>/dev/null)
|
|
|
|
|
[ -z "$type" ] && { echo "Error: Coral type not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
echo "Fetching Coral device from configuration..."
|
|
|
|
|
device=$(uci get frigate.detectors.device 2>/dev/null)
|
|
|
|
|
[ -z "$device" ] && { echo "Error: Coral device not found in configuration."; exit 1; }
|
|
|
|
|
|
|
|
|
|
LAN_IP=$(uci get network.lan.ipaddr)
|
|
|
|
|
LAN_IP="${LAN_IP%/*}"
|
|
|
|
@ -44,16 +64,6 @@ do_install_detail() {
|
|
|
|
|
mkdir -p /opt/docker2/compose/frigate
|
|
|
|
|
touch /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
|
|
|
|
|
# Write global settings to config.yml using yq
|
|
|
|
|
# Replace these uci get commands with actual commands to get these variables
|
|
|
|
|
local usbcoral=$(uci get frigate.@frigate_config[0].usbcoral)
|
|
|
|
|
local hwaccel=$(uci get frigate.@frigate_config[0].hwaccel)
|
|
|
|
|
local storage=$(uci get frigate.@frigate_config[0].storage)
|
|
|
|
|
local mqtt=$(uci get frigate.@frigate_config[0].mqtt)
|
|
|
|
|
local host=$(uci get frigate.@frigate_config[0].host)
|
|
|
|
|
local coral=$(uci get frigate.@frigate_config[0].coral)
|
|
|
|
|
local type=$(uci get frigate.@frigate_config[0].type)
|
|
|
|
|
|
|
|
|
|
yq eval ".usbcoral = \"$usbcoral\"" -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
yq eval ".hwaccel = \"$hwaccel\"" -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
yq eval ".storage = \"$storage\"" -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|