]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test(SYSTEMD-INITRD): lock down this test to boot without shell
authorJo Zzsi <jozzsicsataban@gmail.com>
Sat, 27 Sep 2025 15:30:54 +0000 (11:30 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Sat, 27 Sep 2025 17:45:01 +0000 (13:45 -0400)
Demonstrate the steps and cprovide coverage for root filesystem
on a ext4 filesystem with systemd but without dracut-systemd and shell

test/TEST-42-SYSTEMD-INITRD/test.sh

index fc741c74f2eb446d12c61d382efea806335953c8..c70b02431647c56e273b4954844f11e7828d5261 100755 (executable)
@@ -2,7 +2,7 @@
 set -eu
 
 # shellcheck disable=SC2034
-TEST_DESCRIPTION="root filesystem on a ext4 filesystem with systemd but without dracut-systemd"
+TEST_DESCRIPTION="root filesystem on a ext4 filesystem with systemd but without dracut-systemd and shell"
 
 test_check() {
     command -v systemctl &> /dev/null
@@ -85,9 +85,16 @@ test_setup() {
         -m "systemd-initrd base" \
         "$TESTDIR"/initramfs-systemd-initrd
 
-    # verify that dracut systemd services are not included
     (
-        cd "$TESTDIR"/initrd/dracut.*/initramfs/usr/lib/systemd/system/
+        # remove all shell scripts and the shell itself from the generated initramfs
+        # to demonstrate a shell-less optimized boot
+        cd "$TESTDIR"/initrd/dracut.*/initramfs
+        rm "$(realpath bin/sh)"
+        rm bin/sh
+        find . -name "*.sh" -delete
+
+        # verify that dracut systemd services are not included
+        cd usr/lib/systemd/system/
         for f in dracut*.service; do
             if [ -e "$f" ]; then
                 echo "unexpected dracut service found: $f"