diff options
author | mtm <mtm@FreeBSD.org> | 2004-02-27 09:58:50 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2004-02-27 09:58:50 +0000 |
commit | dec03ccb5c325881993b3abae93916d32383469f (patch) | |
tree | 9b99554f1164efca4969ead17ee7095201531941 /etc | |
parent | 8638aa49b9d3218827a7838f527bf2c1ecee3115 (diff) | |
download | FreeBSD-src-dec03ccb5c325881993b3abae93916d32383469f.zip FreeBSD-src-dec03ccb5c325881993b3abae93916d32383469f.tar.gz |
NetBSD rev. 1.61
Implement ``one'' prefix to allow a "one shot" operation as if
${rcvar}=yes yet all the other prerequisite tests are still performed.
The existing ``force'' prefix is a sledgehammer that ignores all the
prerequisite checks and always returns a zero exit status; this is a
more gentle approach to the problem of "manipulate this disabled
service without editing rc.conf(5)".
Obtained From: NetBSD
# We have a work-around in our version of rc.subr that
# makes force* return a non-zero exit status if the
# command/service could not be acted upon. The work-around
# is no longer necessary and should be removed.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.subr | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/etc/rc.subr b/etc/rc.subr index c1e3b8b..48aadb9 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -326,6 +326,7 @@ wait_for_pids() # ------ --------- # fast Skip the pid check, and set rc_fast=yes # force Set ${rcvar} to YES, and set rc_force=yes +# one Set ${rcvar} to YES # # The following globals are used: # @@ -435,7 +436,7 @@ wait_for_pids() # # Variable Purpose # -------- ------- -# rc_arg Argument to command, after fast/force processing +# rc_arg Argument to command, after fast/force/one processing # performed # # rc_flags Flags to start the default command with. @@ -458,14 +459,23 @@ run_rc_command() err 3 'run_rc_command: $name is not set.' fi + _rc_prefix= case "$rc_arg" in fast*) # "fast" prefix; don't check pid rc_arg=${rc_arg#fast} rc_fast=yes ;; - force*) # "force prefix; always start - rc_arg=${rc_arg#force} + force*) # "force prefix; always run rc_force=yes + _rc_prefix=force + rc_arg=${rc_arg#${_rc_prefix}} + if [ -n "${rcvar}" ]; then + eval ${rcvar}=YES + fi + ;; + one*) # "one" prefix; set ${rcvar}=yes + _rc_prefix=one + rc_arg=${rc_arg#${_rc_prefix}} if [ -n "${rcvar}" ]; then eval ${rcvar}=YES fi @@ -749,8 +759,8 @@ $command $rc_flags $command_args" fi _rc_restart_done=true - ( $0 ${rc_force:+force}stop ) - $0 ${rc_force:+force}start + ( $0 ${_rc_prefix}stop ) + $0 ${_rc_prefix}start if [ -n "$_postcmd" ]; then eval $_postcmd @@ -885,7 +895,7 @@ load_rc_config() # rc_usage() { - echo -n 1>&2 "Usage: $0 [fast|force](" + echo -n 1>&2 "Usage: $0 [fast|force|one](" _sep= for _elem; do |