]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
mount-usr: Calculate and pass full fsck options when mounting /usr.
authorColin Guthrie <colin@mageia.org>
Thu, 15 Dec 2011 21:53:46 +0000 (21:53 +0000)
committerHarald Hoyer <harald@redhat.com>
Wed, 22 Feb 2012 17:11:27 +0000 (18:11 +0100)
Edited-By: Harald Hoyer <harald@redhat.com>
modules.d/98usrmount/mount-usr.sh

index 8042d3a3da5ebca1bca9363d0412a6e0b3b9fd50..3e23b15ee898b206e592f2a36fdea2a818a4b520 100755 (executable)
@@ -5,6 +5,35 @@
 type info >/dev/null 2>&1 || . /lib/dracut-lib.sh
 type fsck_single >/dev/null 2>&1 || . /lib/fs-lib.sh
 
+fsck_usr()
+{
+    local _dev=$1
+    local _fs=$2
+    local _fsckoptions
+
+    if [ -f "$NEWROOT"/fsckoptions ]; then
+        _fsckoptions=$(cat "$NEWROOT"/fsckoptions)
+    fi
+
+    if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then
+        _fsckoptions="-f $_fsckoptions"
+    elif [ -f "$NEWROOT"/.autofsck ]; then
+        [ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
+        if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
+            AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
+        fi
+        if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
+            warn "*** Warning -- the system did not shut down cleanly. "
+            warn "*** Dropping you to a shell; the system will continue"
+            warn "*** when you leave the shell."
+            emergency_shell
+        fi
+        _fsckoptions="$AUTOFSCK_OPT $_fsckoptions"
+    fi
+
+    fsck_single "$_dev" "$_fs" "$_fsckoptions"
+}
+
 mount_usr()
 {
     local _dev _mp _fs _opts _rest _usr_found _ret _freq _passno
@@ -29,8 +58,8 @@ mount_usr()
 
     if [ "x$_usr_found" != "x" ]; then
         # we have to mount /usr
-        if [ "x0" != "x${_passno:-0}" ]; then
-            fsck_single "$_dev" "$_fs"
+        if [ "0" != "${_passno:-0}" ]; then
+            fsck_usr "$_dev" "$_fs"
         else
             :
         fi