Don't try to fsck root device if "/" is not mentioned in fstab.

Also don't assume that all network mounts are "nfs".
This commit is contained in:
apb 2011-09-20 12:13:21 +00:00
parent 9b296e99bc
commit b80ac66c04
1 changed files with 28 additions and 14 deletions

View File

@ -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 @@ fsck_root_start()
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