Blame 0020-usrmount-mount-usr.sh-give-emergency_shell-if-usr-mo.patch

Harald Hoyer c4a5a0
From f225f180e363a42307dfcdb962e751476dd1a210 Mon Sep 17 00:00:00 2001
Harald Hoyer c4a5a0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer c4a5a0
Date: Mon, 2 Jul 2012 18:51:20 +0200
Harald Hoyer c4a5a0
Subject: [PATCH] usrmount/mount-usr.sh: give emergency_shell if /usr mount
Harald Hoyer c4a5a0
 failed
Harald Hoyer c4a5a0
Harald Hoyer c4a5a0
---
Harald Hoyer c4a5a0
 modules.d/98usrmount/mount-usr.sh |   22 +++++++++++++---------
Harald Hoyer c4a5a0
 1 file changed, 13 insertions(+), 9 deletions(-)
Harald Hoyer c4a5a0
Harald Hoyer c4a5a0
diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
Harald Hoyer c4a5a0
index 5cf4eb8..3173241 100755
Harald Hoyer c4a5a0
--- a/modules.d/98usrmount/mount-usr.sh
Harald Hoyer c4a5a0
+++ b/modules.d/98usrmount/mount-usr.sh
Harald Hoyer c4a5a0
@@ -74,17 +74,21 @@ mount_usr()
Harald Hoyer c4a5a0
             if [ "0" != "${_passno:-0}" ]; then
Harald Hoyer c4a5a0
                 fsck_usr "$_dev" "$_fs" "$_opts"
Harald Hoyer c4a5a0
                 _fsck_ret=$?
Harald Hoyer c4a5a0
-                echo $_fsck_ret >/run/initramfs/usr-fsck
Harald Hoyer c4a5a0
+                [ $_fsck_ret -ne 255 ] && echo $_fsck_ret >/run/initramfs/usr-fsck
Harald Hoyer c4a5a0
             fi
Harald Hoyer c4a5a0
         fi
Harald Hoyer c4a5a0
-        if [ $_fsck_ret -ne 255 ]; then
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
+        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
+        if ! ismounted /usr; then
Harald Hoyer c4a5a0
+            warn "Mounting /usr to $NEWROOT/usr failed"
Harald Hoyer c4a5a0
+            warn "*** Dropping you to a shell; the system will continue"
Harald Hoyer c4a5a0
+            warn "*** when you leave the shell."
Harald Hoyer c4a5a0
+            emergency_shell
Harald Hoyer c4a5a0
         fi
Harald Hoyer c4a5a0
     fi
Harald Hoyer c4a5a0
 }