diff options
author | lme <lme@FreeBSD.org> | 2016-04-23 16:19:34 +0000 |
---|---|---|
committer | lme <lme@FreeBSD.org> | 2016-04-23 16:19:34 +0000 |
commit | 96447551d7fdb195a9f47300089f20aaf82604a7 (patch) | |
tree | 5695515d0de6848ff9f1807c4854111fe019b9d7 /etc | |
parent | 965a2e6f88f38fed96ad8e3cdfa7edb2a56e1db3 (diff) | |
download | FreeBSD-src-96447551d7fdb195a9f47300089f20aaf82604a7.zip FreeBSD-src-96447551d7fdb195a9f47300089f20aaf82604a7.tar.gz |
- Add two new subcommands to rc.subr:
"describe" shows an rc script's description
"extracommands" shows an rc script's non-standard commands like "reload", "configtest", "keygen", etc
- Update the rc(8) manpage and the tcsh(1) completion examples to reflect these changes
Approved by: bapt
Sponsored by: Essen Linuxhotel Hackathon 2016
Differential Revision: D452
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.subr | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/etc/rc.subr b/etc/rc.subr index cdec9a2..d04e253 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -844,6 +844,10 @@ check_startmsgs() # # enabled Return true if the service is enabled. # +# describe Show the service's description +# +# extracommands Show the service's extra commands +# # Variables available to methods, and after run_rc_command() has # completed: # @@ -912,7 +916,7 @@ run_rc_command() eval _override_command=\$${name}_program command=${_override_command:-$command} - _keywords="start stop restart rcvar enabled $extra_commands" + _keywords="start stop restart rcvar enabled describe extracommands $extra_commands" rc_pid= _pidcmd= _procname=${procname:-${command}} @@ -962,12 +966,13 @@ run_rc_command() if [ "$_elem" != "$rc_arg" ]; then continue fi - # if ${rcvar} is set, $1 is not "rcvar" + # if ${rcvar} is set, $1 is not "rcvar" and not "describe" # and ${rc_pid} is not set, then run # checkyesno ${rcvar} # and return if that failed # - if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a "$rc_arg" != "stop" ] || + if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a "$rc_arg" != "stop" \ + -a "$rc_arg" != "describe" ] || [ -n "${rcvar}" -a "$rc_arg" = "stop" -a -z "${rc_pid}" ]; then if ! checkyesno ${rcvar}; then if [ -n "${rc_quiet}" ]; then @@ -1004,6 +1009,16 @@ run_rc_command() case "$rc_arg" in # default operations... + describe) + if [ -n "$desc" ]; then + echo "$desc" + fi + ;; + + extracommands) + echo "$extra_commands" + ;; + status) _run_rc_precmd || return 1 if [ -n "$rc_pid" ]; then |