From 053a5b27b69db50b60e192b78959230b5fb475ac Mon Sep 17 00:00:00 2001 From: wiedehopf Date: Sun, 20 Oct 2024 17:14:13 +0200 Subject: [PATCH] make shellcheck happy (#208) * make shellcheck happy * make shellcheck runnable on request * make beast-splitter wait for data source and target on startup --- .github/workflows/shellcheck.yml | 3 ++- rootfs/etc/init.d/beast-splitter | 1 + rootfs/etc/init.d/dump1090 | 1 + rootfs/etc/init.d/dump978 | 1 + rootfs/etc/s6-overlay/scripts/978raw-splitter | 2 +- rootfs/etc/s6-overlay/scripts/beast-splitter | 13 ++++++++++++- rootfs/etc/s6-overlay/scripts/dump1090 | 2 +- rootfs/etc/s6-overlay/scripts/dump978 | 2 +- rootfs/etc/s6-overlay/scripts/piaware | 2 +- rootfs/etc/s6-overlay/scripts/skyaware | 2 +- rootfs/etc/s6-overlay/scripts/skyaware978 | 2 +- 11 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 452beea..310e813 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -2,6 +2,7 @@ name: Linting (Shellcheck) on: + workflow_dispatch: pull_request: branches: - main @@ -11,7 +12,7 @@ jobs: shellcheck: name: Run shellcheck against shell scripts runs-on: ubuntu-latest - if: ${{ github.event_name == 'pull_request' }} + if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} steps: - uses: actions/checkout@v4.2.0 - name: Pull koalaman/shellcheck:stable Image diff --git a/rootfs/etc/init.d/beast-splitter b/rootfs/etc/init.d/beast-splitter index c178f0c..e916f19 100755 --- a/rootfs/etc/init.d/beast-splitter +++ b/rootfs/etc/init.d/beast-splitter @@ -1,4 +1,5 @@ #!/command/with-contenv sh +# shellcheck shell=sh # "dummy" SysV-style init script, to allow piaware to restart beast-splitter. # piaware calls SysV init script to restart beast-splitter (package/fa_services.tcl invoke_service_action). diff --git a/rootfs/etc/init.d/dump1090 b/rootfs/etc/init.d/dump1090 index d787624..a9f6d75 100755 --- a/rootfs/etc/init.d/dump1090 +++ b/rootfs/etc/init.d/dump1090 @@ -1,4 +1,5 @@ #!/command/with-contenv sh +# shellcheck shell=sh # "dummy" SysV-style init script, to allow piaware to restart dump1090. # piaware calls SysV init script to restart dump1090 (package/fa_services.tcl invoke_service_action). diff --git a/rootfs/etc/init.d/dump978 b/rootfs/etc/init.d/dump978 index f043f3f..539eb80 100755 --- a/rootfs/etc/init.d/dump978 +++ b/rootfs/etc/init.d/dump978 @@ -1,4 +1,5 @@ #!/command/with-contenv sh +# shellcheck shell=sh # "dummy" SysV-style init script, to allow piaware to restart dump978. # piaware calls SysV init script to restart dump978 (package/fa_services.tcl invoke_service_action). diff --git a/rootfs/etc/s6-overlay/scripts/978raw-splitter b/rootfs/etc/s6-overlay/scripts/978raw-splitter index 478254b..ff2b8a7 100755 --- a/rootfs/etc/s6-overlay/scripts/978raw-splitter +++ b/rootfs/etc/s6-overlay/scripts/978raw-splitter @@ -1,5 +1,5 @@ #!/command/with-contenv bash -# shellcheck shell=bash +# shellcheck shell=bash disable=SC1091,2154 set -eo pipefail source /scripts/common diff --git a/rootfs/etc/s6-overlay/scripts/beast-splitter b/rootfs/etc/s6-overlay/scripts/beast-splitter index 34c9ed3..964f629 100755 --- a/rootfs/etc/s6-overlay/scripts/beast-splitter +++ b/rootfs/etc/s6-overlay/scripts/beast-splitter @@ -1,5 +1,5 @@ #!/command/with-contenv bash -# shellcheck shell=bash +# shellcheck shell=bash disable=SC1091,2154 set -eo pipefail source /scripts/common @@ -14,5 +14,16 @@ BEASTSPLITTER_BIN="/usr/local/bin/beast-splitter" BEASTSPLITTER_CMD=("--net" "$BEASTHOST:${BEASTPORT:-30005}") BEASTSPLITTER_CMD+=("--connect" "127.0.0.1:30004") +# beast-splitter takes 60 seconds to reconnect +# wait for data source to be online +while ! nc -z "${BEASTHOST}" "${BEASTPORT:-30005}" >/dev/null 2>&1; do + sleep 1 +done +# wait for dump1090 to be online +while ! nc -z 127.0.0.1 30004 >/dev/null 2>&1; do + sleep 1 +done + + # shellcheck disable=SC2016 exec "${s6wrap[@]}" "${BEASTSPLITTER_BIN}" "${BEASTSPLITTER_CMD[@]}" diff --git a/rootfs/etc/s6-overlay/scripts/dump1090 b/rootfs/etc/s6-overlay/scripts/dump1090 index 3a557ec..6652d50 100755 --- a/rootfs/etc/s6-overlay/scripts/dump1090 +++ b/rootfs/etc/s6-overlay/scripts/dump1090 @@ -1,5 +1,5 @@ #!/command/with-contenv bash -# shellcheck shell=bash +# shellcheck shell=bash disable=SC1091,2154 set -eo pipefail source /scripts/common diff --git a/rootfs/etc/s6-overlay/scripts/dump978 b/rootfs/etc/s6-overlay/scripts/dump978 index de4b00e..07b88f3 100755 --- a/rootfs/etc/s6-overlay/scripts/dump978 +++ b/rootfs/etc/s6-overlay/scripts/dump978 @@ -1,5 +1,5 @@ #!/command/with-contenv bash -#shellcheck shell=bash +# shellcheck shell=bash disable=SC1091,2154 source /scripts/common diff --git a/rootfs/etc/s6-overlay/scripts/piaware b/rootfs/etc/s6-overlay/scripts/piaware index 87b5d10..df8c384 100755 --- a/rootfs/etc/s6-overlay/scripts/piaware +++ b/rootfs/etc/s6-overlay/scripts/piaware @@ -1,5 +1,5 @@ #!/command/with-contenv bash -# shellcheck shell=bash +# shellcheck shell=bash disable=SC1091,2154 set -eo pipefail source /scripts/common diff --git a/rootfs/etc/s6-overlay/scripts/skyaware b/rootfs/etc/s6-overlay/scripts/skyaware index 9454ffa..60f6a93 100755 --- a/rootfs/etc/s6-overlay/scripts/skyaware +++ b/rootfs/etc/s6-overlay/scripts/skyaware @@ -1,5 +1,5 @@ #!/command/with-contenv bash -# shellcheck shell=bash +# shellcheck shell=bash disable=SC1091,2154 # Depends on dump1090 diff --git a/rootfs/etc/s6-overlay/scripts/skyaware978 b/rootfs/etc/s6-overlay/scripts/skyaware978 index 7e03d05..e5e5ffc 100755 --- a/rootfs/etc/s6-overlay/scripts/skyaware978 +++ b/rootfs/etc/s6-overlay/scripts/skyaware978 @@ -1,5 +1,5 @@ #!/command/with-contenv bash -#shellcheck shell=bash +# shellcheck shell=bash disable=SC1091,2154 source /scripts/common