From c8b513cc6e5d22143fa6e1343d426be86a64fba4 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Fri, 14 Mar 2025 22:43:41 -0400 Subject: [PATCH] main/postmarketos-mkinitfs-hook-ci: Handle shellcheck checks - Point shellcheck to the files this is sourcing - Tell it about the shell in use - Drop unused variable (grepped around) The last change is about how the hooks are ran. The warning shellcheck was giving was that using `if ; then ...; fi` is preferred, instead of comparing `$?`. This is exactly what is now being done, so the branches have been swapped around, and the command (full path to a hook) is being used within the if condition. Signed-off-by: Samuel Dionne-Riel Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6335 --- main/postmarketos-mkinitfs-hook-ci/05-ci.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/main/postmarketos-mkinitfs-hook-ci/05-ci.sh b/main/postmarketos-mkinitfs-hook-ci/05-ci.sh index d1c91268b..00812f63c 100644 --- a/main/postmarketos-mkinitfs-hook-ci/05-ci.sh +++ b/main/postmarketos-mkinitfs-hook-ci/05-ci.sh @@ -1,9 +1,10 @@ #!/bin/sh -# shellcheck disable=SC1091 -. ./init_functions.sh -. /usr/share/misc/source_deviceinfo +# shellcheck shell=busybox -TEST="" +# shellcheck source=../postmarketos-initramfs/init_functions.sh +. ./init_functions.sh +# shellcheck source=../devicepkg-utils/source_deviceinfo +. /usr/share/misc/source_deviceinfo DID_FAIL=0 @@ -12,13 +13,12 @@ echo "==> disabling dmesg on console" dmesg -n 2 for f in /usr/libexec/pmos-tests-initramfs/*; do - echo -e "\n==> Running test $f\n\n" - $f - if [ $? -ne 0 ]; then + printf '\n==> Running test "%s"\n\n\n' "$f" + if $f; then + echo "==> OK: $f" + else echo "==> FAIL: $f" DID_FAIL=1 - else - echo "==> OK: $f" fi done