diff options
author | Mike Makonnen <mtm@FreeBSD.org> | 2008-01-26 11:22:12 +0000 |
---|---|---|
committer | Mike Makonnen <mtm@FreeBSD.org> | 2008-01-26 11:22:12 +0000 |
commit | a850398f3bf14c030292f3f324d693e13940d6d9 (patch) | |
tree | 3ffc7b47836dbed4121a871b92fbc45d56084147 /etc | |
parent | c6eaff9892ea9cd9b057e1de68c033e68dcc2a4d (diff) | |
download | src-a850398f3bf14c030292f3f324d693e13940d6d9.tar.gz src-a850398f3bf14c030292f3f324d693e13940d6d9.zip |
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.
Notes
Notes:
svn path=/head/; revision=175676
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc | 2 | ||||
-rw-r--r-- | etc/rc.d/netif | 2 | ||||
-rw-r--r-- | etc/rc.subr | 17 |
3 files changed, 18 insertions, 3 deletions
@@ -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` diff --git a/etc/rc.d/netif b/etc/rc.d/netif index c2ac7119c0e1..78cca6125c38 100644 --- a/etc/rc.d/netif +++ b/etc/rc.d/netif @@ -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 diff --git a/etc/rc.subr b/etc/rc.subr index ba3e0a4e852e..b74a0863e788 100644 --- a/etc/rc.subr +++ b/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 |