From: Harald Hoyer Date: Mon, 8 Dec 2014 09:43:54 +0000 (+0100) Subject: Fixed the dracut-shutdown.service X-Git-Tag: 041~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25b987fed6bd5926a5c1d4027ec91a3c56d3aa85;p=thirdparty%2Fdracut.git Fixed the dracut-shutdown.service Make the service a oneshot service, which remains after exit. This ensures, that the ExecStop is executed later on, if a shutdown occurs. --- diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh index 8b30af12e..8b9b80f9c 100644 --- a/dracut-initramfs-restore.sh +++ b/dracut-initramfs-restore.sh @@ -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 diff --git a/modules.d/98systemd/dracut-shutdown.service b/modules.d/98systemd/dracut-shutdown.service index a4a08ca32..21c9d298f 100644 --- a/modules.d/98systemd/dracut-shutdown.service +++ b/modules.d/98systemd/dracut-shutdown.service @@ -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