]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test: graceful poweroff for systemd based tests
authorJo Zzsi <jozzsicsataban@gmail.com>
Sat, 11 Jan 2025 02:04:59 +0000 (21:04 -0500)
committerLaszlo <laszlo.gombos@gmail.com>
Sat, 11 Jan 2025 12:29:43 +0000 (07:29 -0500)
This PR makes the test case more life-like and prepares
for testing dracut-shutdown.

test/modules.d/80test-root/test-init.sh

index c7ab6f63af1a4fc1451f2c7f172c407f38c5ea73..ad472959acdddada2eff50f334f8f8d76a036f6d 100755 (executable)
@@ -29,4 +29,11 @@ fi
 
 echo "made it to the rootfs!"
 echo "Powering down."
-poweroff -f
+
+if [ -f /usr/lib/systemctl ]; then
+    # graceful poweroff
+    systemctl poweroff
+else
+    # force immediate poweroff
+    poweroff -f
+fi