Blame SOURCES/0378-shutdown-guard-against-read-only-run.patch

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