]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Fixed the dracut-shutdown.service
authorHarald Hoyer <harald@redhat.com>
Mon, 8 Dec 2014 09:43:54 +0000 (10:43 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 8 Dec 2014 10:32:26 +0000 (11:32 +0100)
Make the service a oneshot service, which remains after exit. This
ensures, that the ExecStop is executed later on, if a shutdown occurs.

dracut-initramfs-restore.sh
modules.d/98systemd/dracut-shutdown.service

index 8b30af12eafb69395ae88d94a95b4aab361afc5d..8b9b80f9cf2c2cbee259072c89a4b6084b691e73 100644 (file)
@@ -2,6 +2,10 @@
 
 set -e
 
+# do some sanity checks first
+[ -e /run/initramfs/bin/sh ] && exit 0
+[ -e /run/initramfs/.need_shutdown ] || exit 0
+
 KERNEL_VERSION="$(uname -r)"
 
 [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
index a4a08ca32b12c280d9a3cb25f375203a76d8bfcb..21c9d298f5678df2abb426c8282bc9a326ea1980 100644 (file)
@@ -8,13 +8,14 @@
 [Unit]
 Description=Restore /run/initramfs on shutdown
 Documentation=man:dracut-shutdown.service(8)
-After=local-fs.target
+After=local-fs.target boot.mount boot.automount
 Wants=local-fs.target
-Before=systemd-reboot.service shutdown.target
+Conflicts=shutdown.target umount.target
 DefaultDependencies=no
-ConditionPathExists=/run/initramfs/.need_shutdown
 ConditionPathExists=!/run/initramfs/bin/sh
 
 [Service]
+RemainAfterExit=yes
+Type=oneshot
 ExecStart=/bin/true
 ExecStop=/usr/lib/dracut/dracut-initramfs-restore