]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test(FULL-SYSTEM): simplify and make it easier to maintain
authorJo Zzsi <jozzsicsataban@gmail.com>
Sat, 17 Aug 2024 11:41:50 +0000 (07:41 -0400)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Mon, 19 Aug 2024 12:14:46 +0000 (08:14 -0400)
Remove packaging and distribution specific systemd service files.

No need to explicitly check if /usr is mounted as
without it Switch Root service would fail with the following
error:

'Failed to start initrd-switch-root.service - Switch Root.'

test/TEST-04-FULL-SYSTEMD/test-init.sh
test/TEST-04-FULL-SYSTEMD/test.sh

index c60c0ff0eaf570244f1b3e8962d6ebc4e483c67c..8111ad39e83fe9638f1d2fe09c48e0e0e6c9d656 100755 (executable)
@@ -1,21 +1,7 @@
 #!/bin/sh
 : > /dev/watchdog
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v plymouth > /dev/null 2>&1 && plymouth --quit
 exec > /dev/console 2>&1
 
-systemctl --failed --no-legend --no-pager > /run/failed
-
-ismounted() {
-    findmnt "$1" > /dev/null 2>&1
-}
-
-if ! ismounted /usr; then
-    echo "**************************FAILED**************************"
-    echo "/usr not mounted!!"
-    cat /proc/mounts >> /run/failed
-    echo "**************************FAILED**************************"
-fi
+/usr/bin/systemctl --failed --no-legend --no-pager > /run/failed
 
 . /sbin/test-init.sh
index 86f8797547b6cc4f78b35220c2b8b0a7106fe2a6..8cbf3483c4fe09fc19302d454b3261990646b376 100755 (executable)
@@ -62,37 +62,13 @@ test_setup() {
 
     # Create what will eventually be our root filesystem onto an overlay
     "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \
-        -m "test-root systemd-ldconfig" \
+        -m "test-root systemd" \
         -i "${PKGLIBDIR}/modules.d/80test-root/test-init.sh" "/sbin/test-init.sh" \
         -i ./test-init.sh /sbin/test-init \
         -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1
 
     mkdir -p "$TESTDIR"/overlay/source && cp -a "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* && export initdir=$TESTDIR/overlay/source
 
-    if type -P rpm &> /dev/null; then
-        rpm -ql systemd | xargs -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l
-    elif type -P dpkg &> /dev/null; then
-        dpkg -L systemd | xargs -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l
-    elif type -P pacman &> /dev/null; then
-        pacman -Q -l systemd | while read -r _ a; do printf -- "%s\0" "$a"; done | xargs -0 -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l
-    elif type -P equery &> /dev/null; then
-        equery f 'sys-apps/systemd*' | xargs -r "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l
-    else
-        echo "Can't install systemd base"
-        return 1
-    fi
-
-    # softlink mtab
-    ln -fs /proc/self/mounts "$initdir"/etc/mtab
-
-    # install any Execs from the service files
-    grep -Eho '^Exec[^ ]*=[^ ]+' "$initdir"{,/usr}/lib/systemd/system/*.service \
-        | while read -r i || [ -n "$i" ]; do
-            i=${i##Exec*=}
-            i=${i##-}
-            "$PKGLIBDIR"/dracut-install ${initdir:+-D "$initdir"} -o -a -l "$i"
-        done
-
     # setup the testsuite target
     mkdir -p "$initdir"/etc/systemd/system
     cat > "$initdir"/etc/systemd/system/testsuite.target << EOF