Blame 0029-Fixed-the-dracut-shutdown.service.patch

Harald Hoyer 7c0aab
From 25b987fed6bd5926a5c1d4027ec91a3c56d3aa85 Mon Sep 17 00:00:00 2001
Harald Hoyer 7c0aab
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 7c0aab
Date: Mon, 8 Dec 2014 10:43:54 +0100
Harald Hoyer 7c0aab
Subject: [PATCH] Fixed the dracut-shutdown.service
Harald Hoyer 7c0aab
Harald Hoyer 7c0aab
Make the service a oneshot service, which remains after exit. This
Harald Hoyer 7c0aab
ensures, that the ExecStop is executed later on, if a shutdown occurs.
Harald Hoyer 7c0aab
---
Harald Hoyer 7c0aab
 dracut-initramfs-restore.sh                 | 4 ++++
Harald Hoyer 7c0aab
 modules.d/98systemd/dracut-shutdown.service | 7 ++++---
Harald Hoyer 7c0aab
 2 files changed, 8 insertions(+), 3 deletions(-)
Harald Hoyer 7c0aab
Harald Hoyer 7c0aab
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
Harald Hoyer 7c0aab
index 8b30af1..8b9b80f 100644
Harald Hoyer 7c0aab
--- a/dracut-initramfs-restore.sh
Harald Hoyer 7c0aab
+++ b/dracut-initramfs-restore.sh
Harald Hoyer 7c0aab
@@ -2,6 +2,10 @@
Harald Hoyer 7c0aab
 
Harald Hoyer 7c0aab
 set -e
Harald Hoyer 7c0aab
 
Harald Hoyer 7c0aab
+# do some sanity checks first
Harald Hoyer 7c0aab
+[ -e /run/initramfs/bin/sh ] && exit 0
Harald Hoyer 7c0aab
+[ -e /run/initramfs/.need_shutdown ] || exit 0
Harald Hoyer 7c0aab
+
Harald Hoyer 7c0aab
 KERNEL_VERSION="$(uname -r)"
Harald Hoyer 7c0aab
 
Harald Hoyer 7c0aab
 [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
Harald Hoyer 7c0aab
diff --git a/modules.d/98systemd/dracut-shutdown.service b/modules.d/98systemd/dracut-shutdown.service
Harald Hoyer 7c0aab
index a4a08ca..21c9d29 100644
Harald Hoyer 7c0aab
--- a/modules.d/98systemd/dracut-shutdown.service
Harald Hoyer 7c0aab
+++ b/modules.d/98systemd/dracut-shutdown.service
Harald Hoyer 7c0aab
@@ -8,13 +8,14 @@
Harald Hoyer 7c0aab
 [Unit]
Harald Hoyer 7c0aab
 Description=Restore /run/initramfs on shutdown
Harald Hoyer 7c0aab
 Documentation=man:dracut-shutdown.service(8)
Harald Hoyer 7c0aab
-After=local-fs.target
Harald Hoyer 7c0aab
+After=local-fs.target boot.mount boot.automount
Harald Hoyer 7c0aab
 Wants=local-fs.target
Harald Hoyer 7c0aab
-Before=systemd-reboot.service shutdown.target
Harald Hoyer 7c0aab
+Conflicts=shutdown.target umount.target
Harald Hoyer 7c0aab
 DefaultDependencies=no
Harald Hoyer 7c0aab
-ConditionPathExists=/run/initramfs/.need_shutdown
Harald Hoyer 7c0aab
 ConditionPathExists=!/run/initramfs/bin/sh
Harald Hoyer 7c0aab
 
Harald Hoyer 7c0aab
 [Service]
Harald Hoyer 7c0aab
+RemainAfterExit=yes
Harald Hoyer 7c0aab
+Type=oneshot
Harald Hoyer 7c0aab
 ExecStart=/bin/true
Harald Hoyer 7c0aab
 ExecStop=/usr/lib/dracut/dracut-initramfs-restore