NetBSD/etc/rc.d/fsck
2008-03-02 21:31:30 +00:00

54 lines
958 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: fsck,v 1.9 2008/03/02 21:31:30 tron Exp $
#
# PROVIDE: fsck
# REQUIRE: localswap
$_rc_subr_loaded . /etc/rc.subr
name="fsck"
start_cmd="fsck_start"
stop_cmd=":"
fsck_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.
echo "Starting file system checks:"
fsck $fsck_flags
local fsck_error="$?"
case $fsck_error in
0) # OK
return
;;
2) # Needs re-run, still fs errors
echo "file systems still have errors; re-run fsck manually!"
;;
4) # Root modified
echo "Root filesystem was modified, rebooting ..."
reboot
echo "Reboot failed; help!"
;;
8) # Check failed
echo "Automatic file system check failed; help!"
;;
12) # Got signal
echo "Boot interrupted."
;;
*)
echo "Unknown error $fsck_error; help!"
;;
esac
stop_boot
}
load_rc_config $name
run_rc_command "$1"