freebsd-dev/etc/rc.d/fsck
Doug Barton 70d4ef1ea1 In regards to the "Starting foo:" type messages at boot time, create and
employ a more generic solution, and use it in the individual rc.d scripts
that also have an $rc_quiet test:

1. Add check_startmsgs() to rc.subr.
2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
variations of [ -z "$rc_quiet" ] with check_startmsgs
3. In savecore add a trailing '.' to the end of the message to make it
more consistent with other scripts.
4. In newsyslog remove a : before the terminal '.' since we do not expect
there to be anything printed out in between to make it more consistent.
5. In the following scripts change "quotes" to 'quotes' where no variables
exist in the message: savecore pf newsyslog
6. In the following scripts substitute if/then/fi for the simpler (and
more consistent) check_startmsgs &&: faith stf
7. In the following scripts separate the "Starting foo:" from the terminal
'.' to make them more consistent: moused hostname pf
8. In nfsclient move the message to its own line to avoid a style bug
9. In pf rc_quiet does not apply to the _stop method, so remove the
test there.
10. In motd add 'quotes' around the terminal '.' for consistency
2009-10-10 22:17:03 +00:00

79 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: fsck
# REQUIRE: localswap
# KEYWORD: nojail
. /etc/rc.subr
name="fsck"
start_cmd="fsck_start"
stop_cmd=":"
fsck_start()
{
if [ "$autoboot" = no ]; then
echo "Fast boot: skipping disk checks."
elif [ ! -r /etc/fstab ]; then
echo "Warning! No /etc/fstab: skipping disk checks."
elif [ "$autoboot" = yes ]; then
# During fsck ignore SIGQUIT
trap : 3
check_startmsgs && echo "Starting file system checks:"
if checkyesno background_fsck; then
fsck -F -p
else
fsck -p
fi
case $? in
0)
;;
2)
stop_boot
;;
4)
echo "Rebooting..."
reboot
echo "Reboot failed; help!"
stop_boot
;;
8)
if checkyesno fsck_y_enable; then
echo "File system preen failed, trying fsck -y ${fsck_y_flags}"
fsck -y ${fsck_y_flags}
case $? in
0)
;;
*)
echo "Automatic file system check failed; help!"
stop_boot
;;
esac
else
echo "Automatic file system check failed; help!"
stop_boot
fi
;;
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"