Add 'one' behavior to rc.subr, update rc.subr.8 .
authorChris Turner <c.turner@199technologies.com>
Sun, 4 Mar 2012 10:43:49 +0000 (10:43 +0000)
committerChris Turner <c.turner@199technologies.com>
Sun, 4 Mar 2012 10:43:49 +0000 (10:43 +0000)
This permits configuring / running services without
requiring *_enable in rc.conf which is handy for non-automatic
services.

Obtained-from: NetBSD

etc/rc.subr
share/man/man8/rc.subr.8

index df9ae4c..27e27ac 100644 (file)
@@ -430,6 +430,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:
 #
@@ -541,7 +542,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.
@@ -564,9 +565,12 @@ dummy_rc_command()
        fast*)                          # "fast" prefix; don't check pid
                rc_arg=${rc_arg#fast}
                ;;
-       force*)                         # "force prefix; always start
+       force*)                         # "force" prefix; always start
                rc_arg=${rc_arg#force}
                ;;
+       one*)                           # "one" prefix; set ${rcvar}=yes
+               rc_arg=${rc_arg#one}
+               ;;
        esac
        set_provide_list $rc_arg $RC_CONFIGURED
        return 0
@@ -585,13 +589,18 @@ run_rc_command()
                rc_arg=${rc_arg#fast}
                rc_fast=yes
                ;;
-       force*)                         # "force prefix; always start
+       force*)                         # "force" prefix; always start
                rc_arg=${rc_arg#force}
                rc_force=yes
                if [ -n "${rcvar}" ]; then
                        eval ${rcvar}=YES
                fi
                ;;
+       one*)                           # "one" prefix; set ${rcvar}=yes
+               rc_arg=${rc_arg#one}
+               if [ -n "${rcvar}" ]; then
+                       eval ${rcvar}=YES
+               fi
        esac
 
        eval _override_command=\$${name}_program
@@ -1038,7 +1047,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 in $*; do
index 0e55235..71723c0 100644 (file)
@@ -329,7 +329,7 @@ with
 .Ar commands
 being the list of valid arguments
 prefixed by
-.Dq "[fast|force]" .
+.Dq "[fast|force|one]" .
 .It Ic reverse_list Ar item Op Ar ...
 Print the list of
 .Ar items
@@ -378,6 +378,10 @@ This ignores
 returning non-zero, and ignores any of the
 .Sy required_*
 tests failing .
+.It Li one
+Skip the checks for
+.Sy rcvar
+being set to yes, but performs all the other prerequisite tests.
 .El
 .Pp
 .Ic run_rc_command