diff --git a/deploy.sh b/deploy.sh old mode 100644 new mode 100755 index 9d05776..d0968c7 --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p gum openssl sops ssh-to-age age sshpass envsubst +#!nix-shell -i bash -p gum openssl sops ssh-to-age age sshpass envsubst pciutils usbutils prerun_action() { echo -e "$1" @@ -128,10 +128,8 @@ hardware_detection() { 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" else echo -e " ℹ️ No Zigbee device found." - TARGET_ZIGBEE="false" fi } @@ -186,7 +184,7 @@ files_generation() { sed -i.bak "/# --- frigate devices --- #/d" docker/frigate.nix fi - if [[ "$TARGET_ZIGBEE" == "true" ]]; then + if [[ -n "$TARGET_ZIGBEE_DEVICE" ]]; then REPLACEMENT="devices:\n - /dev/serial/by-id/${TARGET_ZIGBEE_DEVICE}:/dev/ttyUSB0" sed -i.bak "s|# --- hass devices --- #|$REPLACEMENT|" docker/hass.nix else