From dc03a2b397c68c2dab39e950bdab6133aa041b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 13 Nov 2024 15:05:43 +0100 Subject: [PATCH 1/5] Lint bash scripts with custom shebangs Many scripts in this repository have this shebang: #!/usr/bin/with-contenv bashio However, this doesn't match the shebang regex in action-shellcheck and therefore those files wouldn't get included in the linting check. --- .github/workflows/lint.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1cb0228bdd4..4f79d7ff131 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -50,3 +50,19 @@ jobs: - name: Run linter uses: ludeeus/action-shellcheck@2.0.0 + with: + # Names of scripts with custom shebangs that the action would not + # discover on its own: + additional_files: >- + check_certificate_renewal + cpcd-config-up + discovery + finish + lock-tables-for-backup + matter-server-discovery + reboot + run + shutdown + universal-silabs-flasher-up + unlock-tables-for-backup + vlc-discovery From d70266c7143e0901f05361a65c3be64416314375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 18 Nov 2024 17:39:28 +0100 Subject: [PATCH 2/5] Fix or ignore current shellcheck violations --- .../s6-rc.d/assist_microphone/finish | 3 ++- .../etc/s6-overlay/s6-rc.d/configurator/finish | 3 ++- .../etc/s6-overlay/s6-rc.d/duckdns/finish | 3 ++- .../rootfs/etc/services.d/lets-encrypt/run | 2 ++ .../rootfs/etc/s6-overlay/s6-rc.d/crond/finish | 3 ++- .../rootfs/etc/s6-overlay/s6-rc.d/nginx/finish | 3 ++- .../rootfs/etc/s6-overlay/s6-rc.d/nginx/run | 2 ++ .../etc/s6-overlay/s6-rc.d/otbr-agent/finish | 7 +++++++ .../scripts/universal-silabs-flasher-up | 4 ++++ .../etc/s6-overlay/s6-rc.d/openwakeword/finish | 3 ++- .../etc/s6-overlay/s6-rc.d/openwakeword/run | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/piper/finish | 3 ++- piper/rootfs/etc/s6-overlay/s6-rc.d/piper/run | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/cpcd/finish | 2 ++ .../etc/s6-overlay/s6-rc.d/otbr-agent/run | 18 ++++++++++++++++++ .../rootfs/etc/s6-overlay/s6-rc.d/zigbeed/run | 3 +++ .../scripts/universal-silabs-flasher-up | 4 ++++ .../etc/s6-overlay/s6-rc.d/whisper/finish | 3 ++- .../rootfs/etc/s6-overlay/s6-rc.d/whisper/run | 1 + 19 files changed, 61 insertions(+), 8 deletions(-) diff --git a/assist_microphone/rootfs/etc/s6-overlay/s6-rc.d/assist_microphone/finish b/assist_microphone/rootfs/etc/s6-overlay/s6-rc.d/assist_microphone/finish index 438a276064a..1c046b21855 100755 --- a/assist_microphone/rootfs/etc/s6-overlay/s6-rc.d/assist_microphone/finish +++ b/assist_microphone/rootfs/etc/s6-overlay/s6-rc.d/assist_microphone/finish @@ -4,6 +4,7 @@ # Take down the S6 supervision tree when service fails # s6-overlay docs: https://github.com/just-containers/s6-overlay # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/finish b/configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/finish index 438a276064a..1c046b21855 100755 --- a/configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/finish +++ b/configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/finish @@ -4,6 +4,7 @@ # Take down the S6 supervision tree when service fails # s6-overlay docs: https://github.com/just-containers/s6-overlay # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/finish b/duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/finish index b65123fd243..dfdc5fc0434 100755 --- a/duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/finish +++ b/duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/finish @@ -4,6 +4,7 @@ # Home Assistant Community Add-on: chrony # Take down the S6 supervision tree when chrony fails # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/letsencrypt/rootfs/etc/services.d/lets-encrypt/run b/letsencrypt/rootfs/etc/services.d/lets-encrypt/run index 6cb87e7b46d..34f6cb60901 100755 --- a/letsencrypt/rootfs/etc/services.d/lets-encrypt/run +++ b/letsencrypt/rootfs/etc/services.d/lets-encrypt/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start sshd service if enabled # ============================================================================== @@ -294,6 +295,7 @@ else bashio::log.info "Detecting existing certificate type for ${DOMAIN_ARR[1]}" readarray -t CBCERTS < <(certbot certificates --non-interactive --cert-name "${DOMAIN_ARR[1]}" --config-dir "$CERT_DIR" --work-dir "$WORK_DIR") for output in "${CBCERTS[@]}"; do + # shellcheck disable=SC2076 if [[ $output =~ "No certificates found." ]]; then bashio::log.info "No certificate found - using 'ecdsa' key type." KEY_ARGUMENTS+=("--key-type" "ecdsa") diff --git a/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/crond/finish b/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/crond/finish index 62103a2ecdb..3d25922be40 100644 --- a/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/crond/finish +++ b/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/crond/finish @@ -3,6 +3,7 @@ # ============================================================================== # Take down the S6 supervision tree when daemon fails # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish b/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish index 383d608a8fc..6c11a5d2bb5 100644 --- a/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish +++ b/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish @@ -3,6 +3,7 @@ # ============================================================================== # Take down the S6 supervision tree when daemon fails # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/nginx/run b/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/nginx/run index a68fcc0b78f..fa07c71b8b4 100644 --- a/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/nginx/run +++ b/nginx_proxy/rootfs/etc/s6-overlay/s6-rc.d/nginx/run @@ -7,10 +7,12 @@ set -e bashio::log.info "Merging options & variables for template" +# shellcheck disable=SC2046 JSON_CONF=$(jq --arg port $(bashio::core.port) \ '({options: .}) + ({variables: {port: $port}})' \ /data/options.json) bashio::log.info "Generating nginx.conf from template in /etc/nginx/nginx.conf.gtpl" +# shellcheck disable=SC2086 echo $JSON_CONF | tempio \ -template /etc/nginx/nginx.conf.gtpl \ -out /etc/nginx.conf diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish index dede3e34b9c..752783ea5ba 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash #============================================================================== # OpenThread BorderRouter Daemon finish script #============================================================================== @@ -14,6 +15,7 @@ else bashio::log.info "otbr-agent exited with code $e (by signal $2)." fi +# shellcheck disable=SC1091 . /etc/s6-overlay/scripts/otbr-agent-common ipset_destroy_if_exist() @@ -25,10 +27,13 @@ ipset_destroy_if_exist() done } +# shellcheck disable=SC2154,SC2086 while ip6tables -C FORWARD -o $thread_if -j $otbr_forward_ingress_chain 2> /dev/null; do + # shellcheck disable=SC2086 ip6tables -D FORWARD -o $thread_if -j $otbr_forward_ingress_chain done +# shellcheck disable=SC2086 if ip6tables -L $otbr_forward_ingress_chain 2> /dev/null; then ip6tables -w -F $otbr_forward_ingress_chain ip6tables -w -X $otbr_forward_ingress_chain @@ -39,10 +44,12 @@ ipset_destroy_if_exist otbr-ingress-deny-src-swap ipset_destroy_if_exist otbr-ingress-allow-dst ipset_destroy_if_exist otbr-ingress-allow-dst-swap +# shellcheck disable=SC2154,SC2086 while ip6tables -C FORWARD -i $thread_if -j $otbr_forward_egress_chain 2> /dev/null; do ip6tables -D FORWARD -i $thread_if -j $otbr_forward_egress_chain done +# shellcheck disable=SC2086 if ip6tables -L $otbr_forward_egress_chain 2> /dev/null; then ip6tables -w -F $otbr_forward_egress_chain ip6tables -w -X $otbr_forward_egress_chain diff --git a/openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up b/openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up index 476c844fe9f..468c7649c03 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up +++ b/openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up @@ -1,8 +1,10 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start universal-silabs-flasher if requested # ============================================================================== +# shellcheck disable=SC2034 declare autoflash_firmware declare device declare firmware @@ -36,6 +38,7 @@ if [ -d /sys/devices/platform/soc/fe201800.serial/tty/ttyAMA1 ] && [ "${device}" gpio_reset_flag="--bootloader-reset yellow" else # Check device manufacturer/product information + # shellcheck disable=SC2046,SC2086 usb_device_path=$(realpath /sys/class/tty/$(readlink /sys/class/tty/$(basename ${device}) | sed 's:/[^/]*tty[^/]*::g' )/../) if [ ! -f "${usb_device_path}/idProduct" ]; then bashio::log.info "The selected serial port is not a USB device." @@ -67,5 +70,6 @@ else fi bashio::log.info "Starting universal-silabs-flasher with ${device}" +# shellcheck disable=SC2086 exec universal-silabs-flasher --device ${device} ${gpio_reset_flag} \ flash --ensure-exact-version --allow-cross-flashing --firmware "/root/${firmware}" diff --git a/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/finish b/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/finish index 438a276064a..1c046b21855 100755 --- a/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/finish +++ b/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/finish @@ -4,6 +4,7 @@ # Take down the S6 supervision tree when service fails # s6-overlay docs: https://github.com/just-containers/s6-overlay # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run b/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run index 6e77aa8fcef..4c6b89891f7 100755 --- a/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run +++ b/openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run @@ -9,6 +9,7 @@ if bashio::config.true 'debug_logging'; then flags+=('--debug') fi +# shellcheck disable=SC2068 exec python3 -m wyoming_openwakeword \ --uri 'tcp://0.0.0.0:10400' \ --preload-model 'ok_nabu' \ diff --git a/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/finish b/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/finish index 438a276064a..1c046b21855 100755 --- a/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/finish +++ b/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/finish @@ -4,6 +4,7 @@ # Take down the S6 supervision tree when service fails # s6-overlay docs: https://github.com/just-containers/s6-overlay # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/run b/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/run index e638c7d1ddb..af4c0db7fce 100755 --- a/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/run +++ b/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/run @@ -12,6 +12,7 @@ if bashio::config.true 'debug_logging'; then flags+=('--debug') fi +# shellcheck disable=SC2068 exec python3 -m wyoming_piper \ --piper '/usr/share/piper/piper' \ --uri 'tcp://0.0.0.0:10200' \ diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/finish b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/finish index ea4790f9963..47517f91deb 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/finish +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/finish @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Take down the container if cpcd exits # ============================================================================== @@ -6,6 +7,7 @@ bashio::log.info "CPC ended with exit code ${1} (signal ${2})..." rm -r /dev/shm/cpcd +# shellcheck disable=SC2086 if [ ${1} -ne 0 ] && [ ${1} -ne 256 ]; then /run/s6/basedir/bin/halt fi diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run index 1fd0b29ee76..ca1bbea36df 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run @@ -1,13 +1,18 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # OpenThread BorderRouter start script # ============================================================================== +# shellcheck disable=SC1091 . /etc/s6-overlay/scripts/otbr-agent-common declare backbone_if +# shellcheck disable=SC2034 declare device +# shellcheck disable=SC2034 declare baudrate +# shellcheck disable=SC2034 declare flow_control declare otbr_log_level declare otbr_log_level_int @@ -47,11 +52,13 @@ case "${otbr_log_level}" in ;; esac +# shellcheck disable=SC2086 if [ -z ${backbone_if} ]; then bashio::log.warning "No primary network interface found! Using static eth0." backbone_if="eth0" fi +# shellcheck disable=SC2015 mkdir -p /data/thread && ln -sft /var/lib /data/thread || bashio::exit.nok "Could not create directory /var/lib/thread to store Thread data." if bashio::config.true 'otbr_firewall'; then @@ -61,17 +68,27 @@ if bashio::config.true 'otbr_firewall'; then ipset create -exist otbr-ingress-allow-dst hash:net family inet6 ipset create -exist otbr-ingress-allow-dst-swap hash:net family inet6 + # shellcheck disable=SC2086,SC2154 ip6tables -N $otbr_forward_ingress_chain + # shellcheck disable=SC2086,SC2154 ip6tables -I FORWARD 1 -o $thread_if -j $otbr_forward_ingress_chain + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -m pkttype --pkt-type unicast -i ${thread_if} -j DROP + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -m set --match-set otbr-ingress-deny-src src -j DROP + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -m set --match-set otbr-ingress-allow-dst dst -j ACCEPT + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -m pkttype --pkt-type unicast -j DROP + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -j ACCEPT + # shellcheck disable=SC2086,SC2154 ip6tables -N $otbr_forward_egress_chain + # shellcheck disable=SC2086 ip6tables -I FORWARD 2 -i $thread_if -j $otbr_forward_egress_chain + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_egress_chain -j ACCEPT else # Make sure ip6tables (as used by Docker) allow IP forwarding @@ -97,6 +114,7 @@ echo "${otbr_rest_listen}" > /tmp/otbr-agent-rest-api echo "${otbr_rest_listen_port}" >> /tmp/otbr-agent-rest-api bashio::log.info "Starting otbr-agent..." +# shellcheck disable=SC2086 exec s6-notifyoncheck -d -s 300 -w 300 -n 0 \ "/usr/sbin/otbr-agent" -I ${thread_if} -B "${backbone_if}" \ --rest-listen-address "${otbr_rest_listen}" \ diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/zigbeed/run b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/zigbeed/run index 3389e4f546f..585f42041a1 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/zigbeed/run +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/zigbeed/run @@ -1,7 +1,9 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start EmberZNet Zigbee Daemon # ============================================================================== +# shellcheck disable=SC2015 mkdir -p /data/zigbeed && cd /data/zigbeed || bashio::exit.nok "Could not change to zigbeed working directory" ezsp_listen="::" @@ -14,6 +16,7 @@ if ! bashio::var.has_value "${ezsp_listen_port}"; then fi bashio::log.info "Starting zigbeed..." +# shellcheck disable=SC2086 exec /usr/local/bin/zigbeed --radio-url "spinel+cpc://cpcd_0?iid=1&iid-list=0" \ --ezsp-listen ${ezsp_listen} \ --ezsp-listen-port ${ezsp_listen_port} diff --git a/silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up b/silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up index 0a433710a9f..68477750abd 100755 --- a/silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up +++ b/silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up @@ -1,10 +1,12 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start universal-silabs-flasher # ============================================================================== set -e +# shellcheck disable=SC2034 declare autoflash_firmware declare device declare bootloader_baudrate @@ -54,6 +56,7 @@ else firmware="yellow_ncp-uart-hw_7.4.3.0.gbl" else # Check device manufacturer/product information + # shellcheck disable=SC2046,SC2086 usb_device_path=$(realpath /sys/class/tty/$(readlink /sys/class/tty/$(basename ${device}) | sed 's:/[^/]*tty[^/]*::g' )/../) if [ ! -f "${usb_device_path}/idProduct" ]; then bashio::log.info "The selected serial port is not a USB device." @@ -86,6 +89,7 @@ if bashio::config.true 'verbose'; then fi bashio::log.info "Starting universal-silabs-flasher with ${device} (bootloader baudrate ${bootloader_baudrate})" +# shellcheck disable=SC2086 universal-silabs-flasher \ ${verbose} \ --device ${device} \ diff --git a/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/finish b/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/finish index 8ffaa24099d..d8260274d4c 100755 --- a/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/finish +++ b/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/finish @@ -4,6 +4,7 @@ # Take down the S6 supervision tree when service fails # s6-overlay docs: https://github.com/just-containers/s6-overlay # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/run b/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/run index efe2ca2e1c1..dfab8b1e65f 100755 --- a/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/run +++ b/whisper/rootfs/etc/s6-overlay/s6-rc.d/whisper/run @@ -21,6 +21,7 @@ if bashio::config.true 'debug_logging'; then flags+=('--debug') fi +# shellcheck disable=SC2068 exec python3 -m wyoming_faster_whisper \ --uri 'tcp://0.0.0.0:10300' \ --model "${model}" \ From 648490c6a8ca701f14ffe791f111a4b38bc2202c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Tue, 19 Nov 2024 00:15:03 +0100 Subject: [PATCH 3/5] shellcheck: specify bash shell type for scripts with unrecognized shebangs --- cec_scan/rootfs/etc/services.d/cec-scan/run | 1 + configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/run | 1 + deconz/rootfs/etc/cont-init.d/firmware.sh | 1 + deconz/rootfs/etc/cont-init.d/nginx.sh | 1 + deconz/rootfs/etc/cont-init.d/novnc.sh | 1 + deconz/rootfs/etc/services.d/deconz/discovery | 1 + deconz/rootfs/etc/services.d/deconz/run | 1 + deconz/rootfs/etc/services.d/nginx/run | 1 + deconz/rootfs/etc/services.d/otau-ikea/run | 1 + deconz/rootfs/etc/services.d/otau-ledvance/run | 1 + deconz/rootfs/etc/services.d/websockify/run | 1 + dhcp_server/data/run.sh | 1 + dnsmasq/rootfs/etc/cont-init.d/config.sh | 1 + dnsmasq/rootfs/etc/services.d/dnsmasq/run | 1 + duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/run | 1 + google_assistant/rootfs/etc/services.d/google-assistant/run | 1 + letsencrypt/rootfs/etc/cont-init.d/file-structure.sh | 1 + matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run | 1 + matter_server/rootfs/etc/s6-overlay/scripts/banner.sh | 1 + .../rootfs/etc/s6-overlay/scripts/matter-server-discovery | 1 + mosquitto/rootfs/etc/cont-init.d/mosquitto.sh | 1 + mosquitto/rootfs/etc/cont-init.d/nginx.sh | 1 + mosquitto/rootfs/etc/services.d/mosquitto/discovery | 1 + mosquitto/rootfs/etc/services.d/mosquitto/run | 1 + mosquitto/rootfs/etc/services.d/nginx/run | 1 + nginx_proxy/rootfs/etc/periodic/daily/check_certificate_renewal | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/mdns/finish | 1 + openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/run | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/socat-otbr-tcp/run | 1 + openthread_border_router/rootfs/etc/s6-overlay/scripts/banner.sh | 1 + .../rootfs/etc/s6-overlay/scripts/enable-check.sh | 1 + .../rootfs/etc/s6-overlay/scripts/otbr-agent-configure.sh | 1 + .../rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh | 1 + rpc_shutdown/data/run.sh | 1 + samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run | 1 + samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/run | 1 + samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/run | 1 + silabs-multiprotocol/rootfs/etc/cont-init.d/check-cpcd-shm.sh | 1 + silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/run | 1 + silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish | 1 + silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/run | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish | 1 + silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/socat-cpcd-tcp/run | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/zigbeed/finish | 1 + silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/banner.sh | 1 + .../rootfs/etc/s6-overlay/scripts/cpcd-config-up | 1 + .../rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh | 1 + .../rootfs/etc/s6-overlay/scripts/otbr-enable-check.sh | 1 + .../rootfs/etc/s6-overlay/scripts/socat-cpcd-tcp-enable-check.sh | 1 + .../rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up | 1 + silabs_flasher/rootfs/etc/s6-overlay/scripts/banner.sh | 1 + ssh/rootfs/etc/cont-init.d/apks.sh | 1 + ssh/rootfs/etc/cont-init.d/keygen.sh | 1 + ssh/rootfs/etc/cont-init.d/profile.sh | 1 + ssh/rootfs/etc/cont-init.d/ssh.sh | 1 + ssh/rootfs/etc/services.d/sshd/run | 1 + ssh/rootfs/etc/services.d/ttyd/run | 1 + ssh/rootfs/usr/local/bin/reboot | 1 + ssh/rootfs/usr/local/bin/shutdown | 1 + tellstick/data/run.sh | 1 + vlc/rootfs/etc/cont-init.d/ingress.sh | 1 + vlc/rootfs/etc/cont-init.d/secret.sh | 1 + vlc/rootfs/etc/s6-overlay/scripts/vlc-discovery | 1 + zwave_js/rootfs/etc/cont-init.d/config.sh | 1 + zwave_js/rootfs/etc/cont-init.d/structure.sh | 1 + zwave_js/rootfs/etc/services.d/zwave_js/discovery | 1 + zwave_js/rootfs/etc/services.d/zwave_js/run | 1 + 72 files changed, 72 insertions(+) diff --git a/cec_scan/rootfs/etc/services.d/cec-scan/run b/cec_scan/rootfs/etc/services.d/cec-scan/run index 953fa237213..9ea6c4fecca 100755 --- a/cec_scan/rootfs/etc/services.d/cec-scan/run +++ b/cec_scan/rootfs/etc/services.d/cec-scan/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start CEC scan service # ============================================================================== diff --git a/configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/run b/configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/run index e2ed3d64d10..9d54121b03e 100755 --- a/configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/run +++ b/configurator/rootfs/etc/s6-overlay/s6-rc.d/configurator/run @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start Configurator service # ============================================================================== diff --git a/deconz/rootfs/etc/cont-init.d/firmware.sh b/deconz/rootfs/etc/cont-init.d/firmware.sh index 8e0c23d524a..1254c356aa0 100755 --- a/deconz/rootfs/etc/cont-init.d/firmware.sh +++ b/deconz/rootfs/etc/cont-init.d/firmware.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Manage deCONZ firmware # ============================================================================== diff --git a/deconz/rootfs/etc/cont-init.d/nginx.sh b/deconz/rootfs/etc/cont-init.d/nginx.sh index 2f70a4c5011..66d8ca0b2e9 100755 --- a/deconz/rootfs/etc/cont-init.d/nginx.sh +++ b/deconz/rootfs/etc/cont-init.d/nginx.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Configure NGINX for use with deCONZ # ============================================================================== diff --git a/deconz/rootfs/etc/cont-init.d/novnc.sh b/deconz/rootfs/etc/cont-init.d/novnc.sh index c133526527a..6be4bc781f5 100755 --- a/deconz/rootfs/etc/cont-init.d/novnc.sh +++ b/deconz/rootfs/etc/cont-init.d/novnc.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Setup noVNC # ============================================================================== diff --git a/deconz/rootfs/etc/services.d/deconz/discovery b/deconz/rootfs/etc/services.d/deconz/discovery index 96cd7690a92..332fe8933ee 100755 --- a/deconz/rootfs/etc/services.d/deconz/discovery +++ b/deconz/rootfs/etc/services.d/deconz/discovery @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Send deCONZ discovery information to Home Assistant # ============================================================================== diff --git a/deconz/rootfs/etc/services.d/deconz/run b/deconz/rootfs/etc/services.d/deconz/run index 1e8685e11e4..4d982db34e1 100755 --- a/deconz/rootfs/etc/services.d/deconz/run +++ b/deconz/rootfs/etc/services.d/deconz/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start deCONZ service # ============================================================================== diff --git a/deconz/rootfs/etc/services.d/nginx/run b/deconz/rootfs/etc/services.d/nginx/run index 38ef478552e..27fc3fe4b7c 100755 --- a/deconz/rootfs/etc/services.d/nginx/run +++ b/deconz/rootfs/etc/services.d/nginx/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start NGINX service # ============================================================================== diff --git a/deconz/rootfs/etc/services.d/otau-ikea/run b/deconz/rootfs/etc/services.d/otau-ikea/run index 922a063440e..e3e65f0552b 100755 --- a/deconz/rootfs/etc/services.d/otau-ikea/run +++ b/deconz/rootfs/etc/services.d/otau-ikea/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Download available firmware update for IKEA # ============================================================================== diff --git a/deconz/rootfs/etc/services.d/otau-ledvance/run b/deconz/rootfs/etc/services.d/otau-ledvance/run index 1697f39aa48..f0e60fd21d9 100755 --- a/deconz/rootfs/etc/services.d/otau-ledvance/run +++ b/deconz/rootfs/etc/services.d/otau-ledvance/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Download available firmware update for OSRAM Ledvance # ============================================================================== diff --git a/deconz/rootfs/etc/services.d/websockify/run b/deconz/rootfs/etc/services.d/websockify/run index d75921d60b9..cd329764815 100755 --- a/deconz/rootfs/etc/services.d/websockify/run +++ b/deconz/rootfs/etc/services.d/websockify/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start ozw-admin # ============================================================================== diff --git a/dhcp_server/data/run.sh b/dhcp_server/data/run.sh index ff0b89871dc..11b673abc7a 100755 --- a/dhcp_server/data/run.sh +++ b/dhcp_server/data/run.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash set -e CONFIG="/etc/dhcpd.conf" diff --git a/dnsmasq/rootfs/etc/cont-init.d/config.sh b/dnsmasq/rootfs/etc/cont-init.d/config.sh index 24d3e00d2d6..e1b35e15b5a 100755 --- a/dnsmasq/rootfs/etc/cont-init.d/config.sh +++ b/dnsmasq/rootfs/etc/cont-init.d/config.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # DNSMASQ config # ============================================================================== diff --git a/dnsmasq/rootfs/etc/services.d/dnsmasq/run b/dnsmasq/rootfs/etc/services.d/dnsmasq/run index 06224ffcc6a..07d315ac456 100755 --- a/dnsmasq/rootfs/etc/services.d/dnsmasq/run +++ b/dnsmasq/rootfs/etc/services.d/dnsmasq/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash CONFIG="/etc/dnsmasq.conf" # Run dnsmasq diff --git a/duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/run b/duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/run index 0c606d99467..5a253fc15bf 100755 --- a/duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/run +++ b/duckdns/rootfs/etc/s6-overlay/s6-rc.d/duckdns/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash CERT_DIR=/data/letsencrypt WORK_DIR=/data/workdir diff --git a/google_assistant/rootfs/etc/services.d/google-assistant/run b/google_assistant/rootfs/etc/services.d/google-assistant/run index cacb259147b..c5ba5fd33cb 100755 --- a/google_assistant/rootfs/etc/services.d/google-assistant/run +++ b/google_assistant/rootfs/etc/services.d/google-assistant/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start Google Assistant service # ============================================================================== diff --git a/letsencrypt/rootfs/etc/cont-init.d/file-structure.sh b/letsencrypt/rootfs/etc/cont-init.d/file-structure.sh index 42c5c1390dc..88510d08014 100755 --- a/letsencrypt/rootfs/etc/cont-init.d/file-structure.sh +++ b/letsencrypt/rootfs/etc/cont-init.d/file-structure.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Init folder & structures # ============================================================================== diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run index e51690c9d52..34ff737bb7d 100755 --- a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run +++ b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start matter-server service # ============================================================================== diff --git a/matter_server/rootfs/etc/s6-overlay/scripts/banner.sh b/matter_server/rootfs/etc/s6-overlay/scripts/banner.sh index 37a8218fdf5..074dc4179e5 100755 --- a/matter_server/rootfs/etc/s6-overlay/scripts/banner.sh +++ b/matter_server/rootfs/etc/s6-overlay/scripts/banner.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: Base Images # Displays a simple add-on banner on startup diff --git a/matter_server/rootfs/etc/s6-overlay/scripts/matter-server-discovery b/matter_server/rootfs/etc/s6-overlay/scripts/matter-server-discovery index f37ea192617..efeab56525f 100755 --- a/matter_server/rootfs/etc/s6-overlay/scripts/matter-server-discovery +++ b/matter_server/rootfs/etc/s6-overlay/scripts/matter-server-discovery @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Send matter discovery information to Home Assistant # ============================================================================== diff --git a/mosquitto/rootfs/etc/cont-init.d/mosquitto.sh b/mosquitto/rootfs/etc/cont-init.d/mosquitto.sh index 3882775b2ce..3a0600d8634 100755 --- a/mosquitto/rootfs/etc/cont-init.d/mosquitto.sh +++ b/mosquitto/rootfs/etc/cont-init.d/mosquitto.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Configures mosquitto # ============================================================================== diff --git a/mosquitto/rootfs/etc/cont-init.d/nginx.sh b/mosquitto/rootfs/etc/cont-init.d/nginx.sh index e4a4a5126f6..25dcfa5d6b8 100755 --- a/mosquitto/rootfs/etc/cont-init.d/nginx.sh +++ b/mosquitto/rootfs/etc/cont-init.d/nginx.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Configures NGINX # ============================================================================== diff --git a/mosquitto/rootfs/etc/services.d/mosquitto/discovery b/mosquitto/rootfs/etc/services.d/mosquitto/discovery index 0f45fda3c89..2cc3dde170a 100755 --- a/mosquitto/rootfs/etc/services.d/mosquitto/discovery +++ b/mosquitto/rootfs/etc/services.d/mosquitto/discovery @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Send MQTT discovery information to Home Assistant and service information # to the Supervisor (for other add-ons). diff --git a/mosquitto/rootfs/etc/services.d/mosquitto/run b/mosquitto/rootfs/etc/services.d/mosquitto/run index f25b2bc495b..b53b6b0038c 100755 --- a/mosquitto/rootfs/etc/services.d/mosquitto/run +++ b/mosquitto/rootfs/etc/services.d/mosquitto/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Runs mosquitto # ============================================================================== diff --git a/mosquitto/rootfs/etc/services.d/nginx/run b/mosquitto/rootfs/etc/services.d/nginx/run index a585b2ba91c..78c92a5066a 100755 --- a/mosquitto/rootfs/etc/services.d/nginx/run +++ b/mosquitto/rootfs/etc/services.d/nginx/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Runs the NGINX daemon # ============================================================================== diff --git a/nginx_proxy/rootfs/etc/periodic/daily/check_certificate_renewal b/nginx_proxy/rootfs/etc/periodic/daily/check_certificate_renewal index 120fbfca60d..3d4a8e658ba 100755 --- a/nginx_proxy/rootfs/etc/periodic/daily/check_certificate_renewal +++ b/nginx_proxy/rootfs/etc/periodic/daily/check_certificate_renewal @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Check certificate renewal # ============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish index 208999d7977..ed7485e2f9a 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash #============================================================================== # mDNSResponder finish script #============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/run b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/run index 4d80c10f1da..9a1123b2cd1 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/run +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/mdns/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start mDNSResponder daemon # ============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run index 62cee950756..d340c371a52 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # OpenThread BorderRouter start script # ============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish index 2c9cd489043..608a15d1b0e 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash #============================================================================== # OpenThread BorderRouter web interface finish script #============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run index 76c619348c4..324a75274f7 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start OpenThread BorderRouter web interface # ============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/socat-otbr-tcp/run b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/socat-otbr-tcp/run index 9ae7451c100..4146aae73e7 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/socat-otbr-tcp/run +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/socat-otbr-tcp/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start socat TCP client for OTBR agent daemon # ============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/scripts/banner.sh b/openthread_border_router/rootfs/etc/s6-overlay/scripts/banner.sh index 37a8218fdf5..074dc4179e5 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/scripts/banner.sh +++ b/openthread_border_router/rootfs/etc/s6-overlay/scripts/banner.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: Base Images # Displays a simple add-on banner on startup diff --git a/openthread_border_router/rootfs/etc/s6-overlay/scripts/enable-check.sh b/openthread_border_router/rootfs/etc/s6-overlay/scripts/enable-check.sh index 072b3ff21f2..1b38bffe06a 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/scripts/enable-check.sh +++ b/openthread_border_router/rootfs/etc/s6-overlay/scripts/enable-check.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Disable OTBR Web if necessary ports are not exposed # ============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-configure.sh b/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-configure.sh index 348c835e940..d8f96785e92 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-configure.sh +++ b/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-configure.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Configure OTBR depending on add-on settings # ============================================================================== diff --git a/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh b/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh index e503e187000..190bfd7dd45 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh +++ b/openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Send OTBR discovery information to Home Assistant # ============================================================================== diff --git a/rpc_shutdown/data/run.sh b/rpc_shutdown/data/run.sh index 6dd8139e4da..f3d5e2cec61 100755 --- a/rpc_shutdown/data/run.sh +++ b/rpc_shutdown/data/run.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash set -e # Read from STDIN aliases to send shutdown diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run b/samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run index 3fc7a2ae763..59bf2c0a14d 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Prepare the Samba service for running # ============================================================================== diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/run b/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/run index ea8057041b9..00807ae0b48 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/run +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/run @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start nmbd service # ============================================================================== diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/run b/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/run index 8f3d654782d..731356da904 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/run +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/run @@ -1,4 +1,5 @@ #!/command/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start smbd service # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/cont-init.d/check-cpcd-shm.sh b/silabs-multiprotocol/rootfs/etc/cont-init.d/check-cpcd-shm.sh index 30ae7d753b1..318970c6764 100755 --- a/silabs-multiprotocol/rootfs/etc/cont-init.d/check-cpcd-shm.sh +++ b/silabs-multiprotocol/rootfs/etc/cont-init.d/check-cpcd-shm.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Check that no other CPC instance is running on this system # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/run b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/run index b85f3e94670..46748bdc397 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/run +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/cpcd/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start Co-Processor Communication Daemon (CPCd) # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish index 208999d7977..ed7485e2f9a 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/finish @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash #============================================================================== # mDNSResponder finish script #============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/run b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/run index 4d80c10f1da..9a1123b2cd1 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/run +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/mdns/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start mDNSResponder daemon # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish index 222ad7dd9cb..5cf05b3d838 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash #============================================================================== # OpenThread BorderRouter Daemon finish script #============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish index 2c9cd489043..608a15d1b0e 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/finish @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash #============================================================================== # OpenThread BorderRouter web interface finish script #============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run index 53fc7e616a0..b5b28db2922 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start OpenThread BorderRouter web interface # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/socat-cpcd-tcp/run b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/socat-cpcd-tcp/run index ad24d16c4ce..26df2234482 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/socat-cpcd-tcp/run +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/socat-cpcd-tcp/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start socat TCP client for CPC daemon # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/zigbeed/finish b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/zigbeed/finish index 3e18c7d6c83..c9a82a631ab 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/zigbeed/finish +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/zigbeed/finish @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash #============================================================================== # EmberZNet Zigbee Daemon finish script #============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/banner.sh b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/banner.sh index 37a8218fdf5..074dc4179e5 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/banner.sh +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/banner.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: Base Images # Displays a simple add-on banner on startup diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/cpcd-config-up b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/cpcd-config-up index 9791f90b7a7..0e71d0e744e 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/cpcd-config-up +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/cpcd-config-up @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Generate Silicon Labs Multiprotocol configurations # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh index 7377f674867..bc3ef5d28fa 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Send OTBR discovery information to Home Assistant # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-enable-check.sh b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-enable-check.sh index e6c253c68e2..8cd2c2d30dc 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-enable-check.sh +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-enable-check.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Disable OTBR if not enabled # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/socat-cpcd-tcp-enable-check.sh b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/socat-cpcd-tcp-enable-check.sh index 81c685a6255..6166b077da2 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/socat-cpcd-tcp-enable-check.sh +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/socat-cpcd-tcp-enable-check.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Enable socat-cpcd-tcp service if needed # ============================================================================== diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up index eefa788dc88..c4756dd3afd 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start universal-silabs-flasher if requested # ============================================================================== diff --git a/silabs_flasher/rootfs/etc/s6-overlay/scripts/banner.sh b/silabs_flasher/rootfs/etc/s6-overlay/scripts/banner.sh index 37a8218fdf5..074dc4179e5 100755 --- a/silabs_flasher/rootfs/etc/s6-overlay/scripts/banner.sh +++ b/silabs_flasher/rootfs/etc/s6-overlay/scripts/banner.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: Base Images # Displays a simple add-on banner on startup diff --git a/ssh/rootfs/etc/cont-init.d/apks.sh b/ssh/rootfs/etc/cont-init.d/apks.sh index 35b1d44aa31..f30f784441e 100755 --- a/ssh/rootfs/etc/cont-init.d/apks.sh +++ b/ssh/rootfs/etc/cont-init.d/apks.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # SSH install additional packages on startup # ============================================================================== diff --git a/ssh/rootfs/etc/cont-init.d/keygen.sh b/ssh/rootfs/etc/cont-init.d/keygen.sh index c913a51a8b8..6dd9efdbd57 100755 --- a/ssh/rootfs/etc/cont-init.d/keygen.sh +++ b/ssh/rootfs/etc/cont-init.d/keygen.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # SSH Host keys # ============================================================================== diff --git a/ssh/rootfs/etc/cont-init.d/profile.sh b/ssh/rootfs/etc/cont-init.d/profile.sh index 9818f03e27f..6d4642db4eb 100755 --- a/ssh/rootfs/etc/cont-init.d/profile.sh +++ b/ssh/rootfs/etc/cont-init.d/profile.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Setup persistent user settings # ============================================================================== diff --git a/ssh/rootfs/etc/cont-init.d/ssh.sh b/ssh/rootfs/etc/cont-init.d/ssh.sh index b008be7e8dd..4b6f2b7b29b 100755 --- a/ssh/rootfs/etc/cont-init.d/ssh.sh +++ b/ssh/rootfs/etc/cont-init.d/ssh.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # SSH setup & user # ============================================================================== diff --git a/ssh/rootfs/etc/services.d/sshd/run b/ssh/rootfs/etc/services.d/sshd/run index 4be0401f395..0c9cebe27dc 100755 --- a/ssh/rootfs/etc/services.d/sshd/run +++ b/ssh/rootfs/etc/services.d/sshd/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start sshd service if enabled # ============================================================================== diff --git a/ssh/rootfs/etc/services.d/ttyd/run b/ssh/rootfs/etc/services.d/ttyd/run index b3a97fe1967..1037b4d2f9b 100755 --- a/ssh/rootfs/etc/services.d/ttyd/run +++ b/ssh/rootfs/etc/services.d/ttyd/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start ttyd service for ingress # ============================================================================== diff --git a/ssh/rootfs/usr/local/bin/reboot b/ssh/rootfs/usr/local/bin/reboot index 8ab18283c9d..e53c822980c 100755 --- a/ssh/rootfs/usr/local/bin/reboot +++ b/ssh/rootfs/usr/local/bin/reboot @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # This script overrides the reboot command to reboot the host machine. # ============================================================================== diff --git a/ssh/rootfs/usr/local/bin/shutdown b/ssh/rootfs/usr/local/bin/shutdown index 8dc27e3b5d7..67cb037a567 100755 --- a/ssh/rootfs/usr/local/bin/shutdown +++ b/ssh/rootfs/usr/local/bin/shutdown @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # This script overrides the shutdown command to shutdown the host machine. # ============================================================================== diff --git a/tellstick/data/run.sh b/tellstick/data/run.sh index 1b57bf3f96d..f2ca631f59d 100755 --- a/tellstick/data/run.sh +++ b/tellstick/data/run.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash set -e CONFIG="/etc/tellstick.conf" diff --git a/vlc/rootfs/etc/cont-init.d/ingress.sh b/vlc/rootfs/etc/cont-init.d/ingress.sh index e3e17951481..1a40e83ff0d 100755 --- a/vlc/rootfs/etc/cont-init.d/ingress.sh +++ b/vlc/rootfs/etc/cont-init.d/ingress.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Prepare VLC for ingress access # ============================================================================== diff --git a/vlc/rootfs/etc/cont-init.d/secret.sh b/vlc/rootfs/etc/cont-init.d/secret.sh index e44da81a8fb..c690bc8cc9d 100755 --- a/vlc/rootfs/etc/cont-init.d/secret.sh +++ b/vlc/rootfs/etc/cont-init.d/secret.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Create VLC secret # ============================================================================== diff --git a/vlc/rootfs/etc/s6-overlay/scripts/vlc-discovery b/vlc/rootfs/etc/s6-overlay/scripts/vlc-discovery index f140d8b075c..77c6a9b1f0e 100755 --- a/vlc/rootfs/etc/s6-overlay/scripts/vlc-discovery +++ b/vlc/rootfs/etc/s6-overlay/scripts/vlc-discovery @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Send vlc_telnet discovery information to Home Assistant # ============================================================================== diff --git a/zwave_js/rootfs/etc/cont-init.d/config.sh b/zwave_js/rootfs/etc/cont-init.d/config.sh index bcb554be780..6ac16a22d4b 100755 --- a/zwave_js/rootfs/etc/cont-init.d/config.sh +++ b/zwave_js/rootfs/etc/cont-init.d/config.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Generate Z-Wave JS config file # ============================================================================== diff --git a/zwave_js/rootfs/etc/cont-init.d/structure.sh b/zwave_js/rootfs/etc/cont-init.d/structure.sh index 0e10818768e..2e698f35a5a 100755 --- a/zwave_js/rootfs/etc/cont-init.d/structure.sh +++ b/zwave_js/rootfs/etc/cont-init.d/structure.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Setup folder structure # ============================================================================== diff --git a/zwave_js/rootfs/etc/services.d/zwave_js/discovery b/zwave_js/rootfs/etc/services.d/zwave_js/discovery index a9acd83418f..23041dfb5b1 100755 --- a/zwave_js/rootfs/etc/services.d/zwave_js/discovery +++ b/zwave_js/rootfs/etc/services.d/zwave_js/discovery @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Send zwave_js discovery information to Home Assistant # ============================================================================== diff --git a/zwave_js/rootfs/etc/services.d/zwave_js/run b/zwave_js/rootfs/etc/services.d/zwave_js/run index 02a52b5ec41..a4f1b1a697a 100755 --- a/zwave_js/rootfs/etc/services.d/zwave_js/run +++ b/zwave_js/rootfs/etc/services.d/zwave_js/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Start Z-Wave JS service for Z-Wave radio # ============================================================================== From ab58f7737e5e6de5f07e35aa2025fe81e390190e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Tue, 19 Nov 2024 00:20:35 +0100 Subject: [PATCH 4/5] Convert shutdown script from CRLF line endings to LF --- ssh/rootfs/usr/local/bin/shutdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ssh/rootfs/usr/local/bin/shutdown b/ssh/rootfs/usr/local/bin/shutdown index 67cb037a567..577f52f2b65 100755 --- a/ssh/rootfs/usr/local/bin/shutdown +++ b/ssh/rootfs/usr/local/bin/shutdown @@ -1,6 +1,6 @@ -#!/usr/bin/with-contenv bashio +#!/usr/bin/with-contenv bashio # shellcheck shell=bash -# ============================================================================== -# This script overrides the shutdown command to shutdown the host machine. -# ============================================================================== -bashio::host.shutdown +# ============================================================================== +# This script overrides the shutdown command to shutdown the host machine. +# ============================================================================== +bashio::host.shutdown From ed7dbdeb275d9f1ccc9b9e6b01287c07c1f6d7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Tue, 19 Nov 2024 00:40:05 +0100 Subject: [PATCH 5/5] shellcheck: silence remaining violations for now --- .../etc/s6-overlay/s6-rc.d/mariadb-core/finish | 3 ++- .../s6-overlay/s6-rc.d/mariadb-lock-post/finish | 2 ++ .../s6-overlay/s6-rc.d/mariadb-lock-post/run | 2 ++ .../etc/s6-overlay/s6-rc.d/mariadb-post/run | 2 ++ .../etc/s6-overlay/s6-rc.d/mariadb-pre/run | 4 ++-- .../etc/s6-overlay/s6-rc.d/matter-server/run | 8 ++++++++ .../etc/s6-overlay/s6-rc.d/otbr-agent/run | 17 +++++++++++++++++ samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish | 3 ++- samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish | 3 ++- .../etc/s6-overlay/s6-rc.d/otbr-agent/finish | 11 +++++++++++ .../scripts/universal-silabs-flasher-up | 3 +++ vlc/rootfs/etc/s6-overlay/s6-rc.d/vlc/run | 1 + zwave_js/rootfs/etc/services.d/zwave_js/run | 1 + 13 files changed, 55 insertions(+), 5 deletions(-) diff --git a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/finish b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/finish index 6be8aae00d7..f5feb84b629 100755 --- a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/finish +++ b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/finish @@ -3,6 +3,7 @@ # ============================================================================== # Take down the S6 supervision tree when daemon fails # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-lock-post/finish b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-lock-post/finish index 10ed2404217..9b6ff491630 100755 --- a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-lock-post/finish +++ b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-lock-post/finish @@ -6,12 +6,14 @@ declare MARIADB_LOCK_CORE_PID MARIADB_LOCK_CORE_PID=$(s6-svstat -o pid "/run/service/mariadb-lock-core") +# shellcheck disable=SC2086 if bashio::var.equals ${MARIADB_LOCK_CORE_PID} -1; then bashio::log.error "Invalid mariadb-lock-core process id ${MARIADB_LOCK_CORE_PID}" bashio::exit.nok fi # File descriptor &4 is used as stdin for mysql, because &0 is closed after the mariadb-lock-core service is started +# shellcheck disable=SC2086 echo "UNLOCK TABLES;" > /proc/${MARIADB_LOCK_CORE_PID}/fd/4 bashio::log.info "MariaDB tables unlocked" diff --git a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-lock-post/run b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-lock-post/run index 38ba3a6485c..c3bbfa320c1 100755 --- a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-lock-post/run +++ b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-lock-post/run @@ -6,12 +6,14 @@ declare MARIADB_LOCK_CORE_PID MARIADB_LOCK_CORE_PID=$(s6-svstat -o pid "/run/service/mariadb-lock-core") +# shellcheck disable=SC2086 if bashio::var.equals ${MARIADB_LOCK_CORE_PID} -1; then bashio::log.error "Invalid mariadb-lock-core process id ${MARIADB_LOCK_CORE_PID}" bashio::exit.nok fi # File descriptor &4 is used as stdin for mysql, because &0 is closed after the mariadb-lock-core service is started +# shellcheck disable=SC2086 echo "FLUSH TABLES WITH READ LOCK;" > /proc/${MARIADB_LOCK_CORE_PID}/fd/4 bashio::log.info "MariaDB tables locked" diff --git a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-post/run b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-post/run index fe7d792eb87..365d06d9870 100755 --- a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-post/run +++ b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-post/run @@ -8,7 +8,9 @@ function execute_without_error_messages() { local current_log_level="${__BASHIO_LOG_LEVELS[${__BASHIO_LOG_LEVEL}]}" bashio::log.level fatal local exit_code=0 + # shellcheck disable=SC2068 $@ || exit_code=$? + # shellcheck disable=SC2086 bashio::log.level ${current_log_level} return ${exit_code} } diff --git a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-pre/run b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-pre/run index 25ac5927d9e..b3d28bbaaea 100755 --- a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-pre/run +++ b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-pre/run @@ -11,8 +11,8 @@ if ! bashio::fs.directory_exists "${MARIADB_DATA}"; then fi # Save variables -printf "${MARIADB_DATA}" > /var/run/s6/container_environment/MARIADB_DATA -printf "${NEW_INSTALL}" > /var/run/s6/container_environment/NEW_INSTALL +cat <<<"${MARIADB_DATA}" > /var/run/s6/container_environment/MARIADB_DATA +cat <<<"${NEW_INSTALL}" > /var/run/s6/container_environment/NEW_INSTALL # Redirect log output mkdir -p "${MARIADB_DATA}" diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run index 34ff737bb7d..405c7efed9c 100755 --- a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run +++ b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run @@ -25,9 +25,11 @@ log_level_sdk=$(bashio::string.lower "$(bashio::config log_level_sdk error)") if bashio::config.has_value "matter_server_version"; then matter_server_version=$(bashio::config 'matter_server_version') bashio::log.info "Installing Python Matter Server ${matter_server_version}" + # shellcheck disable=SC2102 pip3 install --pre python-matter-server[server]=="${matter_server_version}" elif bashio::config.true "beta"; then bashio::log.info 'Upgrading Python Matter Server to latest pre-release' + # shellcheck disable=SC2102 pip3 install --upgrade --pre python-matter-server[server] fi @@ -53,20 +55,24 @@ fi primary_interface="$(bashio::api.supervisor 'GET' '/network/info' '' 'first(.interfaces[] | select (.primary == true)) .interface')" # Try fallback method (e.g. in case NetworkManager is not available) +# shellcheck disable=SC2086 if [ -z ${primary_interface} ]; then bashio::log.warning 'Trying fallback method to determine primary interface' primary_interface="$(ip --json route show default | jq --raw-output '.[0].dev')" fi +# shellcheck disable=SC2086 if [ -z ${primary_interface} ] || [ ${primary_interface} == "null" ]; then bashio::exit.nok "No primary network interface found!" fi if bashio::config.has_value "bluetooth_adapter_id"; then + # shellcheck disable=SC2207 extra_args+=('--bluetooth-adapter' $(bashio::config 'bluetooth_adapter_id')) fi if bashio::config.has_value "matter_server_args"; then + # shellcheck disable=SC2207 extra_args+=($(bashio::config 'matter_server_args')) fi @@ -75,8 +81,10 @@ bashio::log.info "Using '${primary_interface}' as primary network interface." # Send out discovery information to Home Assistant /etc/s6-overlay/scripts/matter-server-discovery & +# shellcheck disable=SC2164 cd /root +# shellcheck disable=SC2206 matter_server_args+=( '--storage-path' "/data" '--port' "${server_port}" diff --git a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run index d340c371a52..a635bdbe84b 100755 --- a/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run +++ b/openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run @@ -4,6 +4,7 @@ # OpenThread BorderRouter start script # ============================================================================== +# shellcheck disable=SC1091 . /etc/s6-overlay/scripts/otbr-agent-common declare backbone_if @@ -62,11 +63,13 @@ case "${otbr_log_level}" in ;; esac +# shellcheck disable=SC2086 if [ -z ${backbone_if} ]; then bashio::log.warning "No primary network interface found! Using static eth0." backbone_if="eth0" fi +# shellcheck disable=SC2015 mkdir -p /data/thread && ln -sft /var/lib /data/thread || bashio::exit.nok "Could not create directory /var/lib/thread to store Thread data." # We compile the OTBR with firewall support, so otbr-agent tries to update the @@ -79,17 +82,27 @@ ipset create -exist otbr-ingress-allow-dst-swap hash:net family inet6 if bashio::config.true 'firewall'; then bashio::log.info "Setup OTBR firewall..." +# shellcheck disable=SC2086,SC2154 ip6tables -N $otbr_forward_ingress_chain +# shellcheck disable=SC2086,SC2154 ip6tables -I FORWARD 1 -o $thread_if -j $otbr_forward_ingress_chain + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -m pkttype --pkt-type unicast -i ${thread_if} -j DROP + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -m set --match-set otbr-ingress-deny-src src -j DROP + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -m set --match-set otbr-ingress-allow-dst dst -j ACCEPT + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -m pkttype --pkt-type unicast -j DROP + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_ingress_chain -j ACCEPT + # shellcheck disable=SC2086,SC2154 ip6tables -N $otbr_forward_egress_chain + # shellcheck disable=SC2086 ip6tables -I FORWARD 2 -i $thread_if -j $otbr_forward_egress_chain + # shellcheck disable=SC2086 ip6tables -A $otbr_forward_egress_chain -j ACCEPT else # Make sure ip6tables (as used by Docker) allow IP forwarding @@ -99,9 +112,12 @@ else fi if bashio::config.true 'nat64'; then + # shellcheck disable=SC2086 iptables -t mangle -A PREROUTING -i ${thread_if} -j MARK --set-mark 0x1001 iptables -t nat -A POSTROUTING -m mark --mark 0x1001 -j MASQUERADE + # shellcheck disable=SC2086 iptables -t filter -A FORWARD -o ${backbone_if} -j ACCEPT + # shellcheck disable=SC2086 iptables -t filter -A FORWARD -i ${backbone_if} -j ACCEPT fi @@ -122,6 +138,7 @@ echo "${otbr_rest_listen}" > /tmp/otbr-agent-rest-api echo "${otbr_rest_listen_port}" >> /tmp/otbr-agent-rest-api bashio::log.info "Starting otbr-agent..." +# shellcheck disable=SC2086 exec s6-notifyoncheck -d -s 300 -w 300 -n 0 stdbuf -oL \ "/usr/sbin/otbr-agent" -I ${thread_if} -B "${backbone_if}" \ --rest-listen-address "${otbr_rest_listen}" \ diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish b/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish index caf12de9d62..9b70a1d9fed 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/nmbd/finish @@ -3,6 +3,7 @@ # ============================================================================== # Take down the S6 supervision tree when nmbd fails # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish b/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish index 137f1e94061..9e8858d079c 100755 --- a/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish +++ b/samba/rootfs/etc/s6-overlay/s6-rc.d/smbd/finish @@ -3,6 +3,7 @@ # ============================================================================== # Take down the S6 supervision tree when smbd fails # ============================================================================== +# shellcheck disable=SC2155 readonly exit_code_container=$( /run/s6-linux-init-container-results/exitcode + echo $((128 + exit_code_signal)) > /run/s6-linux-init-container-results/exitcode fi [[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt elif [[ "${exit_code_service}" -ne 0 ]]; then diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish index 5cf05b3d838..ec2002e0906 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/finish @@ -6,6 +6,7 @@ bashio::log.info "otbr-agent ended with exit code ${1} (signal ${2})..." +# shellcheck disable=SC1091 . /etc/s6-overlay/scripts/otbr-agent-common ipset_destroy_if_exist() @@ -17,12 +18,17 @@ ipset_destroy_if_exist() done } +# shellcheck disable=SC2086,SC2154 while ip6tables -C FORWARD -o $thread_if -j $otbr_forward_ingress_chain 2> /dev/null; do + # shellcheck disable=SC2086 ip6tables -D FORWARD -o $thread_if -j $otbr_forward_ingress_chain done +# shellcheck disable=SC2086 if ip6tables -L $otbr_forward_ingress_chain 2> /dev/null; then + # shellcheck disable=SC2086 ip6tables -w -F $otbr_forward_ingress_chain + # shellcheck disable=SC2086 ip6tables -w -X $otbr_forward_ingress_chain fi @@ -31,12 +37,17 @@ ipset_destroy_if_exist otbr-ingress-deny-src-swap ipset_destroy_if_exist otbr-ingress-allow-dst ipset_destroy_if_exist otbr-ingress-allow-dst-swap +# shellcheck disable=SC2086,SC2154 while ip6tables -C FORWARD -i $thread_if -j $otbr_forward_egress_chain 2> /dev/null; do + # shellcheck disable=SC2086 ip6tables -D FORWARD -i $thread_if -j $otbr_forward_egress_chain done +# shellcheck disable=SC2086 if ip6tables -L $otbr_forward_egress_chain 2> /dev/null; then + # shellcheck disable=SC2086 ip6tables -w -F $otbr_forward_egress_chain + # shellcheck disable=SC2086 ip6tables -w -X $otbr_forward_egress_chain fi bashio::log.info "OTBR firewall teardown completed." diff --git a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up index c4756dd3afd..00b5d5d8616 100755 --- a/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up +++ b/silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up @@ -4,6 +4,7 @@ # Start universal-silabs-flasher if requested # ============================================================================== +# shellcheck disable=SC2034 declare autoflash_firmware declare device declare firmware @@ -31,6 +32,7 @@ if [ -d /sys/devices/platform/soc/fe201800.serial/tty/ttyAMA1 ] && [ "${device}" gpio_reset_flag="--yellow-gpio-reset" else # Check device manufacturer/product information + # shellcheck disable=SC2046,SC2086 usb_device_path=$(realpath /sys/class/tty/$(readlink /sys/class/tty/$(basename ${device}))/../../../../) if [ ! -f "${usb_device_path}/idProduct" ]; then bashio::log.info "The selected serial port is not a USB device." @@ -60,5 +62,6 @@ fi echo 460800 > /tmp/known-baudrate bashio::log.info "Starting universal-silabs-flasher with ${device}" +# shellcheck disable=SC2086 exec universal-silabs-flasher --device ${device} \ flash ${gpio_reset_flag} --ensure-exact-version --allow-cross-flashing --firmware "/root/${firmware}" diff --git a/vlc/rootfs/etc/s6-overlay/s6-rc.d/vlc/run b/vlc/rootfs/etc/s6-overlay/s6-rc.d/vlc/run index 27617f08381..be9a37415f4 100755 --- a/vlc/rootfs/etc/s6-overlay/s6-rc.d/vlc/run +++ b/vlc/rootfs/etc/s6-overlay/s6-rc.d/vlc/run @@ -3,6 +3,7 @@ # ============================================================================== # Start VLC service # ============================================================================== +# shellcheck disable=SC2155 readonly PASSWORD="$(cat /data/secret)" # Send out discovery information to Home Assistant diff --git a/zwave_js/rootfs/etc/services.d/zwave_js/run b/zwave_js/rootfs/etc/services.d/zwave_js/run index a4f1b1a697a..4ab60295f02 100755 --- a/zwave_js/rootfs/etc/services.d/zwave_js/run +++ b/zwave_js/rootfs/etc/services.d/zwave_js/run @@ -17,4 +17,5 @@ fi export ZWAVEJS_EXTERNAL_CONFIG=/data/db # Run daemon, passing external config directory in as environment variable +# shellcheck disable=SC2086 exec zwave-server ${SERIAL_DEVICE} --config /etc/zwave_config.json --disable-dns-sd