NetBSD/etc/rc.d/fsck
apb 31edfc6f0f * Add a stop_boot() function in rc.subr, to terminate a multi-user boot
by killing the parent process.  The parent's PID is saved in $RC_PID.
* In all rc.d/* scripts that previously tried to stop the boot,
  replace in-line code with "stop_boot".
* Document this.

This should fix PR 29822.
2007-04-06 14:20:08 +00:00

58 lines
829 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: fsck,v 1.7 2007/04/06 14:20:17 apb 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."
else
trap : 2 # Ignore SIGINT, SIGQUIT, so we
trap : 3 # enter single-user mode on failure.
echo "Starting file system checks:"
fsck $fsck_flags
case $? in
0)
;;
2)
stop_boot
;;
4)
echo "Rebooting..."
reboot
echo "Reboot failed; help!"
stop_boot
;;
8)
echo "Automatic file system check failed; help!"
stop_boot
;;
12)
echo "Boot interrupted."
stop_boot
;;
130)
stop_boot
;;
*)
echo "Unknown error; help!"
stop_boot
;;
esac
fi
}
load_rc_config $name
run_rc_command "$1"