summaryrefslogtreecommitdiffstats
path: root/debian/tests/shellcheck
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:29:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:29:49 +0000
commit67c56c3a28638e52dcb16c58f910682579367093 (patch)
tree4e18c10d4dc8f987a1ea77be8aebf2075ac4930c /debian/tests/shellcheck
parentAdding upstream version 0.140. (diff)
downloadinitramfs-tools-debian.tar.xz
initramfs-tools-debian.zip
Adding debian version 0.140.debian/0.140debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/shellcheck')
-rwxr-xr-xdebian/tests/shellcheck25
1 files changed, 25 insertions, 0 deletions
diff --git a/debian/tests/shellcheck b/debian/tests/shellcheck
new file mode 100755
index 0000000..37765a2
--- /dev/null
+++ b/debian/tests/shellcheck
@@ -0,0 +1,25 @@
+#!/bin/sh -eu
+
+export LC_COLLATE=C.UTF-8
+unset LC_ALL
+
+# The packages that install hook/boot scripts
+dpkg -S /usr/share/initramfs-tools/hooks /usr/share/initramfs-tools/scripts \
+ | sed 's/: .*//; s/, /\n/g' \
+ | sort -u \
+ > "$AUTOPKGTEST_TMP/installed-packages"
+
+# The packages that we're prepared to test
+echo "initramfs-tools initramfs-tools-core klibc-utils kmod udev" \
+ | sed 's/ /\n/g' \
+ | sort -u \
+ > "$AUTOPKGTEST_TMP/tested-packages"
+
+# Installed hook/boot scripts that we're prepared to test
+join "$AUTOPKGTEST_TMP/installed-packages" "$AUTOPKGTEST_TMP/tested-packages" \
+ | xargs dpkg -L \
+ | grep -E '^/usr/share/initramfs-tools/(hooks|scripts)/' \
+ | while read file; do test -f "$file" && printf '%s\n' "$file"; done \
+ > "$AUTOPKGTEST_TMP/hook-boot-scripts"
+
+shellcheck -e SC1090,SC1091 -s dash /usr/bin/lsinitramfs /usr/sbin/mkinitramfs /usr/bin/unmkinitramfs /usr/share/initramfs-tools/hook-functions /usr/share/initramfs-tools/init /etc/kernel/postinst.d/initramfs-tools /etc/kernel/postrm.d/initramfs-tools /usr/sbin/update-initramfs $(cat "$AUTOPKGTEST_TMP/hook-boot-scripts")