Blame 0003-98usrmount-force-mounting-usr-read-only-option-rd.us.patch

Harald Hoyer c4a5a0
From 2ee48b4b4b07e28980ff851991d2884d8c76c12c Mon Sep 17 00:00:00 2001
Harald Hoyer c4a5a0
From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
Harald Hoyer c4a5a0
Date: Fri, 29 Jun 2012 13:58:18 +0200
Harald Hoyer c4a5a0
Subject: [PATCH] 98usrmount: force mounting /usr read-only option
Harald Hoyer c4a5a0
 (rd.usrmount.ro)
Harald Hoyer c4a5a0
Harald Hoyer c4a5a0
---
Harald Hoyer c4a5a0
 dracut.cmdline.7.asc              |    5 +++++
Harald Hoyer c4a5a0
 modules.d/98usrmount/mount-usr.sh |    9 +++++++--
Harald Hoyer c4a5a0
 2 files changed, 12 insertions(+), 2 deletions(-)
Harald Hoyer c4a5a0
Harald Hoyer c4a5a0
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
Harald Hoyer c4a5a0
index 883223c..5669700 100644
Harald Hoyer c4a5a0
--- a/dracut.cmdline.7.asc
Harald Hoyer c4a5a0
+++ b/dracut.cmdline.7.asc
Harald Hoyer c4a5a0
@@ -76,6 +76,11 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
Harald Hoyer c4a5a0
 ----
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
+**rd.usrmount.ro**:
Harald Hoyer c4a5a0
+    force mounting _/usr_ read-only.  Use this option if your init system
Harald Hoyer c4a5a0
+    performs remount of _/usr_ the same as it does with rootfs.
Harald Hoyer c4a5a0
+
Harald Hoyer c4a5a0
+
Harald Hoyer c4a5a0
 Misc
Harald Hoyer c4a5a0
 ~~~~
Harald Hoyer c4a5a0
 **rd.driver.blacklist=**_<drivername>[,<drivername>,...]_::
Harald Hoyer c4a5a0
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
Harald Hoyer c4a5a0
index 92638d1..748ac01 100755
Harald Hoyer c4a5a0
--- a/modules.d/98usrmount/mount-usr.sh
Harald Hoyer c4a5a0
+++ b/modules.d/98usrmount/mount-usr.sh
Harald Hoyer c4a5a0
@@ -68,8 +68,13 @@ mount_usr()
Harald Hoyer c4a5a0
         _ret=$?
Harald Hoyer c4a5a0
         echo $_ret >/run/initramfs/usr-fsck
Harald Hoyer c4a5a0
         if [ $_ret -ne 255 ]; then
Harald Hoyer c4a5a0
-            info "Mounting /usr"
Harald Hoyer c4a5a0
-            mount "$NEWROOT/usr" 2>&1 | vinfo
Harald Hoyer c4a5a0
+            if getargbool 0 rd.usrmount.ro; then
Harald Hoyer c4a5a0
+                info "Mounting /usr (read-only forced)"
Harald Hoyer c4a5a0
+                mount -r "$NEWROOT/usr" 2>&1 | vinfo
Harald Hoyer c4a5a0
+            else
Harald Hoyer c4a5a0
+                info "Mounting /usr"
Harald Hoyer c4a5a0
+                mount "$NEWROOT/usr" 2>&1 | vinfo
Harald Hoyer c4a5a0
+            fi
Harald Hoyer c4a5a0
         fi
Harald Hoyer c4a5a0
     fi
Harald Hoyer c4a5a0
 }