Fixed non working sed commands for devices section in the compose.yaml
This commit is contained in:
@@ -109,7 +109,7 @@ hardware_detection() {
|
||||
TARGET_GRAPHICS="false"
|
||||
fi
|
||||
echo -e "\n\n 🔎 Detecting transconding acceleration on target host..."
|
||||
if ssh_to_host "ls /dev/dri/renderD128 2>/dev/null"; then
|
||||
if ssh_to_host "ls /dev/dri/renderD128" 2>/dev/null; then
|
||||
echo -e " ✅ Transcoding capable card detected."
|
||||
TARGET_GRAPHICS_RENDERER="true"
|
||||
else
|
||||
@@ -117,7 +117,7 @@ hardware_detection() {
|
||||
TARGET_GRAPHICS_RENDERER="false"
|
||||
fi
|
||||
echo -e "\n\n 🔎 Detecting USB Google Coral TPU on target host..."
|
||||
if ssh_to_host "lsusb | grep -iq 'google' 2>/dev/null"; then
|
||||
if ssh_to_host "lsusb | grep -iq 'google'" 2>/dev/null; then
|
||||
echo -e " ✅ USB Google Coral TPU detected."
|
||||
TARGET_USB_CORAL="true"
|
||||
else
|
||||
@@ -125,7 +125,7 @@ hardware_detection() {
|
||||
TARGET_USB_CORAL="false"
|
||||
fi
|
||||
echo -e "\n\n 🔎 Detecting Zigbee coordinator on target host..."
|
||||
if ssh_to_host "ls /dev/serial/by-id/ | grep -i 'zigbee' 2>/dev/null"; then
|
||||
if ssh_to_host "ls /dev/serial/by-id/ | grep -i 'zigbee'" 2>/dev/null; then
|
||||
echo -e " ✅ Zigbee device found in /dev/serial/by-id/."
|
||||
TARGET_ZIGBEE_DEVICE=$(ssh_to_host "ls /dev/serial/by-id/ | grep -i 'zigbee'")
|
||||
TARGET_ZIGBEE="true"
|
||||
@@ -171,64 +171,26 @@ files_generation() {
|
||||
sed -i s+HOME_ROUTER_IP+$HOME_ROUTER_IP+g configuration.nix
|
||||
|
||||
echo -e "\n\n ✅ Adapting the docker configuration to your hardware..."
|
||||
if [[ "$TARGET_GRAPHICS_RENDERER" == "true" && "$TARGET_USB_CORAL" == "true" ]]; then
|
||||
sed -i.bak '
|
||||
/^[[:space:]]*# ----------------------------------------- #/{
|
||||
N;
|
||||
/DEVICES SECTION WILL APPEAR HERE IF CORAL/{
|
||||
N;
|
||||
/TPU OR INTEGRATED GRAPHICS ARE PRESENT/{
|
||||
N;
|
||||
/----------------------------------------- #/c\
|
||||
devices:\
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128\
|
||||
- /dev/bus/usb:/dev/bus/usb
|
||||
}
|
||||
}
|
||||
}' docker/frigate.nix
|
||||
elif [[ "$TARGET_GRAPHICS_RENDERER" == "true" && "$TARGET_USB_CORAL" == "false" ]]; then
|
||||
sed -i.bak '
|
||||
/^[[:space:]]*# ----------------------------------------- #/{
|
||||
N;
|
||||
/DEVICES SECTION WILL APPEAR HERE IF CORAL/{
|
||||
N;
|
||||
/TPU OR INTEGRATED GRAPHICS ARE PRESENT/{
|
||||
N;
|
||||
/----------------------------------------- #/c\
|
||||
devices:\
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128\
|
||||
}
|
||||
}
|
||||
}' docker/frigate.nix
|
||||
elif [[ "$TARGET_GRAPHICS_RENDERER" == "false" && "$TARGET_USB_CORAL" == "true" ]]; then
|
||||
sed -i.bak '
|
||||
/^[[:space:]]*# ----------------------------------------- #/{
|
||||
N;
|
||||
/DEVICES SECTION WILL APPEAR HERE IF CORAL/{
|
||||
N;
|
||||
/TPU OR INTEGRATED GRAPHICS ARE PRESENT/{
|
||||
N;
|
||||
/----------------------------------------- #/c\
|
||||
devices:\
|
||||
- /dev/bus/usb:/dev/bus/usb
|
||||
}
|
||||
}
|
||||
}' docker/frigate.nix
|
||||
DEVICES_BLOCK=""
|
||||
if [[ "$TARGET_GRAPHICS_RENDERER" == "true" ]]; then
|
||||
DEVICES_BLOCK+=" - /dev/dri/renderD128:/dev/dri/renderD128\n"
|
||||
fi
|
||||
if [[ "$TARGET_USB_CORAL" == "true" ]]; then
|
||||
DEVICES_BLOCK+=" - /dev/bus/usb:/dev/bus/usb\n"
|
||||
fi
|
||||
|
||||
if [[ -n "$DEVICES_BLOCK" ]]; then
|
||||
REPLACEMENT="devices:\n${DEVICES_BLOCK%\\n}"
|
||||
sed -i.bak "s|# --- frigate devices --- #|$REPLACEMENT|" docker/frigate.nix
|
||||
else
|
||||
sed -i.bak "/# --- frigate devices --- #/d" docker/frigate.nix
|
||||
fi
|
||||
|
||||
if [[ "$TARGET_ZIGBEE" == "true" ]]; then
|
||||
sed -i.bak \
|
||||
'/^[[:space:]]*# ----------------------------------- #/{
|
||||
N;
|
||||
/DEVICES SECTION WILL APPEAR HERE IF/{
|
||||
N;
|
||||
/ZIGBEE USB DEVICE IS PRESENT/{
|
||||
N;
|
||||
/----------------------------------- #/c\'"
|
||||
devices:\
|
||||
- /dev/serial/by-id/${TARGET_ZIGBEE_DEVICE}:/dev/ttyUSB0
|
||||
}
|
||||
}
|
||||
}" docker/hass.nix
|
||||
REPLACEMENT="devices:\n - /dev/serial/by-id/${TARGET_ZIGBEE_DEVICE}:/dev/ttyUSB0"
|
||||
sed -i.bak "s|# --- hass devices --- #|$REPLACEMENT|" docker/hass.nix
|
||||
else
|
||||
sed -i.bak "/# --- hass devices --- #/d" docker/hass.nix
|
||||
fi
|
||||
|
||||
echo -e "\n\n ✅ Copying files to the new installation..."
|
||||
|
||||
+1
-8
@@ -35,16 +35,9 @@ in
|
||||
environment:
|
||||
FRIGATE_MQTT_USER: $FRIGATE_MQTT_USER
|
||||
FRIGATE_MQTT_PASSWORD: $FRIGATE_MQTT_PASSWORD
|
||||
# ----------------------------------------- #
|
||||
# DEVICES SECTION WILL APPEAR HERE IF CORAL #
|
||||
# TPU OR INTEGRATED GRAPHICS ARE PRESENT #
|
||||
# ----------------------------------------- #
|
||||
# --- frigate devices --- #
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.services.frigate.loadbalancer.server.port=8971
|
||||
- traefik.http.services.frigate.loadbalancer.server.scheme=https
|
||||
- traefik.http.routers.frigate-https.entrypoints=websecure
|
||||
- traefik.http.routers.frigate-https.rule=Host(`cctv.$DOMAIN_NAME`)
|
||||
- traefik.http.routers.frigate-https.tls=true
|
||||
- traefik.http.routers.frigate-https.tls.certresolver=cloudflare
|
||||
restart: unless-stopped
|
||||
|
||||
+1
-4
@@ -24,10 +24,7 @@ in
|
||||
- ${config-dir}/config:/config
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /run/dbus:/run/dbus:ro
|
||||
# ----------------------------------- #
|
||||
# DEVICES SECTION WILL APPEAR HERE IF #
|
||||
# ZIGBEE USB DEVICE IS PRESENT #
|
||||
# ----------------------------------- #
|
||||
# --- hass devices --- #
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.services.home-assistant.loadbalancer.server.port=8123
|
||||
|
||||
Reference in New Issue
Block a user