Re-implement: do not silently fail when a command is not carried
out because the rc.conf(5) variable was not enabled. Display a message that the command wasn't run and offer suggestions on what the user can do. Implement a quiet prefix, which will disable some diagnostics. The fast prefix also implies quiet. During boot we use either fast or quiet. For shutdown we already use 'faststop'. So, this informational message should only appear during interactive use. An additional benefit of having a quiet prefix is that we can start putting some of our diagnostic messages behind this knob and start "de-cluttering" the console during boot and shutdown.
This commit is contained in:
parent
c6eaff9892
commit
a850398f3b
2
etc/rc
2
etc/rc
@ -56,7 +56,7 @@ if [ "$1" = autoboot ]; then
|
||||
rc_fast=yes # run_rc_command(): do fast booting
|
||||
else
|
||||
autoboot=no
|
||||
_boot="start"
|
||||
_boot="quietstart"
|
||||
fi
|
||||
|
||||
dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
|
||||
|
@ -72,7 +72,7 @@ network_start()
|
||||
|
||||
if [ -f /etc/rc.d/ipfilter ] ; then
|
||||
# Resync ipfilter
|
||||
/etc/rc.d/ipfilter resync
|
||||
/etc/rc.d/ipfilter quietresync
|
||||
fi
|
||||
if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then
|
||||
/etc/rc.d/bridge start $cmdifn
|
||||
|
17
etc/rc.subr
17
etc/rc.subr
@ -377,9 +377,10 @@ wait_for_pids()
|
||||
# If argument has a given prefix, then change the operation as follows:
|
||||
# Prefix Operation
|
||||
# ------ ---------
|
||||
# fast Skip the pid check, and set rc_fast=yes
|
||||
# fast Skip the pid check, and set rc_fast=yes, rc_quiet=yes
|
||||
# force Set ${rcvar} to YES, and set rc_force=yes
|
||||
# one Set ${rcvar} to YES
|
||||
# quiet Don't output some diagnostics, and set rc_quiet=yes
|
||||
#
|
||||
# The following globals are used:
|
||||
#
|
||||
@ -522,6 +523,8 @@ wait_for_pids()
|
||||
#
|
||||
# rc_force Not empty if "force" was provided (q.v.)
|
||||
#
|
||||
# rc_quiet Not empty if "quiet" was provided
|
||||
#
|
||||
#
|
||||
run_rc_command()
|
||||
{
|
||||
@ -542,6 +545,7 @@ run_rc_command()
|
||||
fast*) # "fast" prefix; don't check pid
|
||||
rc_arg=${rc_arg#fast}
|
||||
rc_fast=yes
|
||||
rc_quiet=yes
|
||||
;;
|
||||
force*) # "force prefix; always run
|
||||
rc_force=yes
|
||||
@ -558,6 +562,11 @@ run_rc_command()
|
||||
eval ${rcvar}=YES
|
||||
fi
|
||||
;;
|
||||
quiet*) # "quiet" prefix; omit some messages
|
||||
_rc_prefix=quiet
|
||||
rc_arg=${rc_arg#${_rc_prefix}}
|
||||
rc_quiet=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
eval _override_command=\$${name}_program
|
||||
@ -606,6 +615,12 @@ run_rc_command()
|
||||
#
|
||||
if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" ]; then
|
||||
if ! checkyesno ${rcvar}; then
|
||||
if [ -n "${rc_quiet}" ]; then
|
||||
return 0
|
||||
fi
|
||||
echo -n "Cannot '${rc_arg}' $name. Set ${rcvar} to "
|
||||
echo -n "YES in /etc/rc.conf or use 'one${rc_arg}' "
|
||||
echo "instead of '${rc_arg}'."
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user