Home | History | Annotate | Line # | Download | only in rc.d
fsck_root revision 1.3
      1 #!/bin/sh
      2 #
      3 # $NetBSD: fsck_root,v 1.3 2009/07/10 20:02:21 christos Exp $
      4 #
      5 
      6 # PROVIDE: fsck_root
      7 
      8 $_rc_subr_loaded . /etc/rc.subr
      9 
     10 name="fsck_root"
     11 start_cmd="fsck_root_start"
     12 stop_cmd=":"
     13 fstab_file=/etc/fstab
     14 
     15 fsck_root_start()
     16 {
     17 	if [ -e /fastboot ]; then
     18 		echo "Fast boot: skipping disk checks."
     19 		return
     20 	fi
     21 	trap : 2 		# Ignore SIGINT, SIGQUIT, so we
     22 	trap : 3		# enter single-user mode on failure.
     23 
     24 	# Do nothing if root file system has fs_passno=0 in /etc/fstab.
     25 	while read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
     26 	do
     27 		case "${fs_spec}:${fs_file}:${fs_passno}" in
     28 		\#*|'':*)
     29 			continue # skip comment or blank line
     30 			;;
     31 		*:/:0)
     32 			echo "Not checking /: fs_passno = 0 in ${fstab_file}"
     33 			return
     34 			;;
     35 		*:/:*)	case "${fs_spec}" in
     36 			*:*)
     37 				echo "Not checking /: nfs mounted"
     38 				return
     39 				;;
     40 			esac
     41 			;;
     42 		esac
     43 	done <"${fstab_file}"
     44 
     45 	echo "Starting root file system check:"
     46 	fsck $fsck_flags /
     47 	handle_fsck_error "$?"
     48 }
     49 
     50 load_rc_config $name
     51 run_rc_command "$1"
     52