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.
This commit is contained in:
parent
c9d0616d93
commit
c608fcc5fa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126303
22
etc/rc.subr
22
etc/rc.subr
@ -326,6 +326,7 @@ wait_for_pids()
|
|||||||
# ------ ---------
|
# ------ ---------
|
||||||
# fast Skip the pid check, and set rc_fast=yes
|
# fast Skip the pid check, and set rc_fast=yes
|
||||||
# force Set ${rcvar} to YES, and set rc_force=yes
|
# force Set ${rcvar} to YES, and set rc_force=yes
|
||||||
|
# one Set ${rcvar} to YES
|
||||||
#
|
#
|
||||||
# The following globals are used:
|
# The following globals are used:
|
||||||
#
|
#
|
||||||
@ -435,7 +436,7 @@ wait_for_pids()
|
|||||||
#
|
#
|
||||||
# Variable Purpose
|
# Variable Purpose
|
||||||
# -------- -------
|
# -------- -------
|
||||||
# rc_arg Argument to command, after fast/force processing
|
# rc_arg Argument to command, after fast/force/one processing
|
||||||
# performed
|
# performed
|
||||||
#
|
#
|
||||||
# rc_flags Flags to start the default command with.
|
# 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.'
|
err 3 'run_rc_command: $name is not set.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_rc_prefix=
|
||||||
case "$rc_arg" in
|
case "$rc_arg" in
|
||||||
fast*) # "fast" prefix; don't check pid
|
fast*) # "fast" prefix; don't check pid
|
||||||
rc_arg=${rc_arg#fast}
|
rc_arg=${rc_arg#fast}
|
||||||
rc_fast=yes
|
rc_fast=yes
|
||||||
;;
|
;;
|
||||||
force*) # "force prefix; always start
|
force*) # "force prefix; always run
|
||||||
rc_arg=${rc_arg#force}
|
|
||||||
rc_force=yes
|
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
|
if [ -n "${rcvar}" ]; then
|
||||||
eval ${rcvar}=YES
|
eval ${rcvar}=YES
|
||||||
fi
|
fi
|
||||||
@ -749,8 +759,8 @@ $command $rc_flags $command_args"
|
|||||||
fi
|
fi
|
||||||
_rc_restart_done=true
|
_rc_restart_done=true
|
||||||
|
|
||||||
( $0 ${rc_force:+force}stop )
|
( $0 ${_rc_prefix}stop )
|
||||||
$0 ${rc_force:+force}start
|
$0 ${_rc_prefix}start
|
||||||
|
|
||||||
if [ -n "$_postcmd" ]; then
|
if [ -n "$_postcmd" ]; then
|
||||||
eval $_postcmd
|
eval $_postcmd
|
||||||
@ -885,7 +895,7 @@ load_rc_config()
|
|||||||
#
|
#
|
||||||
rc_usage()
|
rc_usage()
|
||||||
{
|
{
|
||||||
echo -n 1>&2 "Usage: $0 [fast|force]("
|
echo -n 1>&2 "Usage: $0 [fast|force|one]("
|
||||||
|
|
||||||
_sep=
|
_sep=
|
||||||
for _elem; do
|
for _elem; do
|
||||||
|
Loading…
Reference in New Issue
Block a user