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 <command...>; 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 <samuel@dionne-riel.com>
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6335
This commit is contained in:
Samuel Dionne-Riel 2025-03-14 22:43:41 -04:00 committed by Pablo Correa Gómez
parent 23894ca89d
commit c8b513cc6e
No known key found for this signature in database
GPG key ID: 7A342565FF635F79

View file

@ -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