Blame 0004-shutdown-guard-against-read-only-run.patch

Harald Hoyer 4226e2
From 54e09dfb72b557ac8ccd48f5d37089287d272ec7 Mon Sep 17 00:00:00 2001
Harald Hoyer 4226e2
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 4226e2
Date: Mon, 30 Nov 2015 11:27:03 +0100
Harald Hoyer 4226e2
Subject: [PATCH] shutdown: guard against read-only /run
Harald Hoyer 4226e2
Harald Hoyer 4226e2
remount the switch rooted /run writeable again.
Harald Hoyer 4226e2
---
Harald Hoyer 4226e2
 modules.d/99shutdown/module-setup.sh | 2 +-
Harald Hoyer 4226e2
 modules.d/99shutdown/shutdown.sh     | 4 ++++
Harald Hoyer 4226e2
 2 files changed, 5 insertions(+), 1 deletion(-)
Harald Hoyer 4226e2
Harald Hoyer 4226e2
diff --git a/modules.d/99shutdown/module-setup.sh b/modules.d/99shutdown/module-setup.sh
Harald Hoyer 4226e2
index b80a82c..5cb3594 100755
Harald Hoyer 4226e2
--- a/modules.d/99shutdown/module-setup.sh
Harald Hoyer 4226e2
+++ b/modules.d/99shutdown/module-setup.sh
Harald Hoyer 4226e2
@@ -14,7 +14,7 @@ depends() {
Harald Hoyer 4226e2
 # called by dracut
Harald Hoyer 4226e2
 install() {
Harald Hoyer 4226e2
     local _d
Harald Hoyer 4226e2
-    inst_multiple umount poweroff reboot halt losetup
Harald Hoyer 4226e2
+    inst_multiple umount poweroff reboot halt losetup stat
Harald Hoyer 4226e2
     inst_multiple -o kexec
Harald Hoyer 4226e2
     inst "$moddir/shutdown.sh" "$prefix/shutdown"
Harald Hoyer 4226e2
     [ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
Harald Hoyer 4226e2
diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh
Harald Hoyer 4226e2
index afee051..918a8a4 100755
Harald Hoyer 4226e2
--- a/modules.d/99shutdown/shutdown.sh
Harald Hoyer 4226e2
+++ b/modules.d/99shutdown/shutdown.sh
Harald Hoyer 4226e2
@@ -12,6 +12,10 @@ export TERM=linux
Harald Hoyer 4226e2
 export PATH=/usr/sbin:/usr/bin:/sbin:/bin
Harald Hoyer 4226e2
 . /lib/dracut-lib.sh
Harald Hoyer 4226e2
 
Harald Hoyer 4226e2
+if [ "$(stat -c '%T' -f /)" = "tmpfs" ]; then
Harald Hoyer 4226e2
+    mount -o remount,rw /
Harald Hoyer 4226e2
+fi
Harald Hoyer 4226e2
+
Harald Hoyer 4226e2
 mkdir /oldsys
Harald Hoyer 4226e2
 for i in sys proc run dev; do
Harald Hoyer 4226e2
     mkdir /oldsys/$i