Blame 0040-98usrmount-use-rw-and-ro-options-instead-of-rd.usrmo.patch

Harald Hoyer 12f6cc
From 5afa95791594383c1f1ef7a757a7482717d6fd5f Mon Sep 17 00:00:00 2001
Harald Hoyer 12f6cc
From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
Harald Hoyer 12f6cc
Date: Thu, 26 Jul 2012 15:05:22 +0200
Harald Hoyer 12f6cc
Subject: [PATCH] 98usrmount: use rw and ro options instead of rd.usrmount.ro
Harald Hoyer 12f6cc
Harald Hoyer 12f6cc
In result /usr is forced to be mounted ro or rw along with /.
Harald Hoyer 12f6cc
---
Harald Hoyer 12f6cc
 dracut.cmdline.7.asc              | 12 ++++++++----
Harald Hoyer 12f6cc
 modules.d/98usrmount/mount-usr.sh | 18 +++++++++---------
Harald Hoyer 12f6cc
 2 files changed, 17 insertions(+), 13 deletions(-)
Harald Hoyer 12f6cc
Harald Hoyer 12f6cc
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
Harald Hoyer 12f6cc
index 755d641..8f642f3 100644
Harald Hoyer 12f6cc
--- a/dracut.cmdline.7.asc
Harald Hoyer 12f6cc
+++ b/dracut.cmdline.7.asc
Harald Hoyer 12f6cc
@@ -61,6 +61,14 @@ rootfstype=ext3
Harald Hoyer 12f6cc
     _/etc/fstab_ of the real root will be parsed for special mount options and
Harald Hoyer 12f6cc
     mounted accordingly.
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
+**ro**::
Harald Hoyer 12f6cc
+    force mounting _/_ and _/usr_ (if it is a separate device) read-only.  If
Harald Hoyer 12f6cc
+    none of ro and rw is present, both are mounted according to _/etc/fstab_.
Harald Hoyer 12f6cc
+
Harald Hoyer 12f6cc
+**rw**::
Harald Hoyer 12f6cc
+    force mounting _/_ and _/usr_ (if it is a separate device) read-write.
Harald Hoyer 12f6cc
+    See also ro option.
Harald Hoyer 12f6cc
+
Harald Hoyer 12f6cc
 **rd.fstab=0**::
Harald Hoyer 12f6cc
     do not honor special mount options for the root filesystem found in
Harald Hoyer 12f6cc
     _/etc/fstab_ of the real root.
Harald Hoyer 12f6cc
@@ -81,10 +89,6 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
Harald Hoyer 12f6cc
     the init system performs fsck before remount, you might want to use this
Harald Hoyer 12f6cc
     option to avoid duplication.
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
-**rd.usrmount.ro**:
Harald Hoyer 12f6cc
-    force mounting _/usr_ read-only.  Use this option if your init system
Harald Hoyer 12f6cc
-    performs remount of _/usr_ the same as it does with rootfs.
Harald Hoyer 12f6cc
-
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
 Misc
Harald Hoyer 12f6cc
 ~~~~
Harald Hoyer 12f6cc
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
Harald Hoyer 12f6cc
index c277d74..98e08e3 100755
Harald Hoyer 12f6cc
--- a/modules.d/98usrmount/mount-usr.sh
Harald Hoyer 12f6cc
+++ b/modules.d/98usrmount/mount-usr.sh
Harald Hoyer 12f6cc
@@ -57,9 +57,12 @@ mount_usr()
Harald Hoyer 12f6cc
                 [ -n "$rflags" ]; then
Harald Hoyer 12f6cc
                 # for btrfs subvolumes we have to mount /usr with the same rflags
Harald Hoyer 12f6cc
                 _opts="${_opts:+${_opts},}${rflags}"
Harald Hoyer 12f6cc
-            elif getarg ro; then
Harald Hoyer 12f6cc
-                # if "ro" is specified, we want /usr to be readonly, too
Harald Hoyer 12f6cc
+            elif getargbool 0 ro; then
Harald Hoyer 12f6cc
+                # if "ro" is specified, we want /usr to be mounted read-only
Harald Hoyer 12f6cc
                 _opts="${_opts:+${_opts},}ro"
Harald Hoyer 12f6cc
+            elif getargbool 0 rw; then
Harald Hoyer 12f6cc
+                # if "rw" is specified, we want /usr to be mounted read-write
Harald Hoyer 12f6cc
+                _opts="${_opts:+${_opts},}rw"
Harald Hoyer 12f6cc
             fi
Harald Hoyer 12f6cc
             echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_freq $_passno"
Harald Hoyer 12f6cc
             _usr_found="1"
Harald Hoyer 12f6cc
@@ -77,13 +80,10 @@ mount_usr()
Harald Hoyer 12f6cc
                 [ $_fsck_ret -ne 255 ] && echo $_fsck_ret >/run/initramfs/usr-fsck
Harald Hoyer 12f6cc
             fi
Harald Hoyer 12f6cc
         fi
Harald Hoyer 12f6cc
-        if getargbool 0 rd.usrmount.ro; then
Harald Hoyer 12f6cc
-            info "Mounting /usr (read-only forced)"
Harald Hoyer 12f6cc
-            mount -r "$NEWROOT/usr" 2>&1 | vinfo
Harald Hoyer 12f6cc
-        else
Harald Hoyer 12f6cc
-            info "Mounting /usr"
Harald Hoyer 12f6cc
-            mount "$NEWROOT/usr" 2>&1 | vinfo
Harald Hoyer 12f6cc
-        fi
Harald Hoyer 12f6cc
+
Harald Hoyer 12f6cc
+        info "Mounting /usr"
Harald Hoyer 12f6cc
+        mount "$NEWROOT/usr" 2>&1 | vinfo
Harald Hoyer 12f6cc
+
Harald Hoyer 12f6cc
         if ! ismounted "$NEWROOT/usr"; then
Harald Hoyer 12f6cc
             warn "Mounting /usr to $NEWROOT/usr failed"
Harald Hoyer 12f6cc
             warn "*** Dropping you to a shell; the system will continue"