2009-04-21 20:08:57 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2010-09-25 19:10:14 +04:00
|
|
|
# $NetBSD: fsck_root,v 1.5 2010/09/25 15:10:14 bad Exp $
|
2009-04-21 20:08:57 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: fsck_root
|
|
|
|
|
|
|
|
$_rc_subr_loaded . /etc/rc.subr
|
|
|
|
|
|
|
|
name="fsck_root"
|
|
|
|
start_cmd="fsck_root_start"
|
|
|
|
stop_cmd=":"
|
2009-04-28 17:08:51 +04:00
|
|
|
fstab_file=/etc/fstab
|
2009-04-21 20:08:57 +04:00
|
|
|
|
|
|
|
fsck_root_start()
|
|
|
|
{
|
|
|
|
if [ -e /fastboot ]; then
|
|
|
|
echo "Fast boot: skipping disk checks."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
trap : 2 # Ignore SIGINT, SIGQUIT, so we
|
|
|
|
trap : 3 # enter single-user mode on failure.
|
|
|
|
|
2009-04-28 17:08:51 +04:00
|
|
|
# Do nothing if root file system has fs_passno=0 in /etc/fstab.
|
|
|
|
while read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
|
|
|
|
do
|
2010-09-25 19:10:14 +04:00
|
|
|
case "${fs_spec}:${fs_file}:${fs_passno:=0}" in
|
2009-04-28 17:08:51 +04:00
|
|
|
\#*|'':*)
|
|
|
|
continue # skip comment or blank line
|
|
|
|
;;
|
|
|
|
*:/:0)
|
|
|
|
echo "Not checking /: fs_passno = 0 in ${fstab_file}"
|
|
|
|
return
|
|
|
|
;;
|
2009-07-11 00:02:21 +04:00
|
|
|
*:/:*) case "${fs_spec}" in
|
|
|
|
*:*)
|
|
|
|
echo "Not checking /: nfs mounted"
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
2010-02-16 05:46:02 +03:00
|
|
|
|
|
|
|
echo "Starting root file system check:"
|
|
|
|
fsck $fsck_flags /
|
|
|
|
handle_fsck_error "$?"
|
|
|
|
return
|
2009-04-28 17:08:51 +04:00
|
|
|
;;
|
|
|
|
esac
|
2010-02-16 05:46:02 +03:00
|
|
|
done < "${fstab_file}"
|
2009-04-21 20:08:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|