Blame 0060-systemd-store-switch-root.conf-in-run-initramfs.patch

Harald Hoyer 35271e
From 38111b96223816bdc48930830f59d0fc674db895 Mon Sep 17 00:00:00 2001
Harald Hoyer 35271e
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 35271e
Date: Wed, 16 May 2012 11:24:42 +0200
Harald Hoyer 35271e
Subject: [PATCH] systemd: store switch-root.conf in /run/initramfs
Harald Hoyer 35271e
Harald Hoyer 35271e
Store switch-root.conf in /run/initramfs/switch-root.conf, so that the
Harald Hoyer 35271e
service does not fail in ExecPost after switching to the real root.
Harald Hoyer 35271e
---
Harald Hoyer 35271e
 modules.d/98systemd/dracut-pre-pivot.sh |    4 ++--
Harald Hoyer 35271e
 modules.d/98systemd/switch-root.service |    2 +-
Harald Hoyer 35271e
 2 files changed, 3 insertions(+), 3 deletions(-)
Harald Hoyer 35271e
Harald Hoyer 35271e
diff --git a/modules.d/98systemd/dracut-pre-pivot.sh b/modules.d/98systemd/dracut-pre-pivot.sh
Harald Hoyer 35271e
index 272b293..a8e9fc1 100755
Harald Hoyer 35271e
--- a/modules.d/98systemd/dracut-pre-pivot.sh
Harald Hoyer 35271e
+++ b/modules.d/98systemd/dracut-pre-pivot.sh
Harald Hoyer 35271e
@@ -27,12 +27,12 @@ for i in "$(getarg real_init=)" "$(getarg init=)"; do
Harald Hoyer 35271e
     __p=$(readlink -f "${NEWROOT}/${i}")
Harald Hoyer 35271e
     if [ -x "$__p" ]; then
Harald Hoyer 35271e
         INIT="$i"
Harald Hoyer 35271e
-        echo "NEWINIT=\"$INIT\"" > /etc/switch-root.conf
Harald Hoyer 35271e
+        echo "NEWINIT=\"$INIT\"" > /run/initramfs/switch-root.conf
Harald Hoyer 35271e
         break
Harald Hoyer 35271e
     fi
Harald Hoyer 35271e
 done
Harald Hoyer 35271e
 
Harald Hoyer 35271e
-echo "NEWROOT=\"$NEWROOT\"" >> /etc/switch-root.conf
Harald Hoyer 35271e
+echo "NEWROOT=\"$NEWROOT\"" >> /run/initramfs/switch-root.conf
Harald Hoyer 35271e
 
Harald Hoyer 35271e
 udevadm control --stop-exec-queue
Harald Hoyer 35271e
 systemctl stop systemd-udev.service
Harald Hoyer 35271e
diff --git a/modules.d/98systemd/switch-root.service b/modules.d/98systemd/switch-root.service
Harald Hoyer 35271e
index 0c41eb0..2abfc90 100644
Harald Hoyer 35271e
--- a/modules.d/98systemd/switch-root.service
Harald Hoyer 35271e
+++ b/modules.d/98systemd/switch-root.service
Harald Hoyer 35271e
@@ -11,6 +11,6 @@ DefaultDependencies=no
Harald Hoyer 35271e
 
Harald Hoyer 35271e
 [Service]
Harald Hoyer 35271e
 Type=oneshot
Harald Hoyer 35271e
-EnvironmentFile=/etc/switch-root.conf
Harald Hoyer 35271e
+EnvironmentFile=/run/initramfs/switch-root.conf
Harald Hoyer 35271e
 ExecStart=/usr/bin/systemctl --force switch-root ${NEWROOT} ${NEWINIT}
Harald Hoyer 35271e
 ExecStopPost=-/usr/bin/systemctl isolate default.target