Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/rc.d Don't try to fsck root device if "/" is not mention...



details:   https://anonhg.NetBSD.org/src/rev/1f34892fccd1
branches:  trunk
changeset: 769723:1f34892fccd1
user:      apb <apb%NetBSD.org@localhost>
date:      Tue Sep 20 12:13:21 2011 +0000

description:
Don't try to fsck root device if "/" is not mentioned in fstab.
Also don't assume that all network mounts are "nfs".

diffstat:

 etc/rc.d/fsck_root |  42 ++++++++++++++++++++++++++++--------------
 1 files changed, 28 insertions(+), 14 deletions(-)

diffs (70 lines):

diff -r 446b0fd1881f -r 1f34892fccd1 etc/rc.d/fsck_root
--- a/etc/rc.d/fsck_root        Tue Sep 20 09:11:06 2011 +0000
+++ b/etc/rc.d/fsck_root        Tue Sep 20 12:13:21 2011 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: fsck_root,v 1.5 2010/09/25 15:10:14 bad Exp $
+# $NetBSD: fsck_root,v 1.6 2011/09/20 12:13:21 apb Exp $
 #
 
 # PROVIDE: fsck_root
@@ -21,31 +21,45 @@
        trap : 2                # Ignore SIGINT, SIGQUIT, so we
        trap : 3                # enter single-user mode on failure.
 
-       # Do nothing if root file system has fs_passno=0 in /etc/fstab.
+       # Do nothing if root file system has fs_passno=0 in /etc/fstab,
+       # or if root file system is not mentioned in /etc/fstab, or if
+       # root file system seems to be a network mount.
+       root_in_fstab=false
        while read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
        do
-               case "${fs_spec}:${fs_file}:${fs_passno:=0}" in
-               \#*|'':*)
-                       continue # skip comment or blank line
-                       ;;
-               *:/:0)
+               # skip comment or blank line
+               case "${fs_spec}" in
+               \#*|'') continue ;;
+               esac
+
+               # fs_freq and fs_passno default to 0 if not specified
+               : ${fs_freq:=0} ${fs_passno:=0}
+
+               case "${fs_file},${fs_passno}" in
+               /,0)
                        echo "Not checking /: fs_passno = 0 in ${fstab_file}"
                        return
                        ;;
-               *:/:*)  case "${fs_spec}" in
+               /,*)
+                       root_in_fstab=true
+                       case "${fs_spec}" in
                        *:*)
-                               echo "Not checking /: nfs mounted"
+                               echo "Not checking /: network mount"
                                return
                                ;;
                        esac
-
-                       echo "Starting root file system check:"
-                       fsck $fsck_flags /
-                       handle_fsck_error "$?"
-                       return
                        ;;
                esac
        done < "${fstab_file}"
+
+       if $root_in_fstab; then
+               echo "Starting root file system check:"
+               fsck $fsck_flags /
+               handle_fsck_error "$?"
+               return
+       else
+               echo "Not checking /: not listed in ${fstab_file}"
+       fi
 }
 
 load_rc_config $name



Home | Main Index | Thread Index | Old Index