From f5d98dd522c7a739c6b998d0aa2d750e31ba894b Mon Sep 17 00:00:00 2001 From: ajacoutot Date: Sun, 24 Aug 2014 07:33:26 +0000 Subject: [PATCH] Make it possible to pass `-d' and `-f' to the rc.d(8) script. man page bits from schwarze@ ok jasper@ schwarze@ --- usr.sbin/rcctl/rcctl.8 | 9 +++++---- usr.sbin/rcctl/rcctl.sh | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/usr.sbin/rcctl/rcctl.8 b/usr.sbin/rcctl/rcctl.8 index c8997b49ff0..2f29852513d 100644 --- a/usr.sbin/rcctl/rcctl.8 +++ b/usr.sbin/rcctl/rcctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rcctl.8,v 1.5 2014/08/21 12:47:22 ajacoutot Exp $ +.\" $OpenBSD: rcctl.8,v 1.6 2014/08/24 07:33:26 ajacoutot Exp $ .\" .\" Copyright (c) 2014 Antoine Jacoutot .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 21 2014 $ +.Dd $Mdocdate: August 24 2014 $ .Dt RCCTL 8 .Os .Sh NAME @@ -22,6 +22,7 @@ .Nd configure and control daemons and services .Sh SYNOPSIS .Nm rcctl +.Op Fl df .Sm off .Cm enable | disable | status | Ar action .Sm on @@ -68,13 +69,13 @@ Without an argument, display all services and .Ar daemon Ns _flags with their values in a format compatible with .Xr rc.conf 8 . -.It Ar action daemon +.It Oo Fl df Oc Ar action daemon Run the .Xr rc.d 8 .Ar daemon script with the .Ar action -argument. +argument, passing through the specified options, if any. .El .Sh EXIT STATUS .Nm Ar action diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh index d809ba6e42e..fe4e0217b21 100644 --- a/usr.sbin/rcctl/rcctl.sh +++ b/usr.sbin/rcctl/rcctl.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: rcctl.sh,v 1.11 2014/08/21 14:26:16 jsg Exp $ +# $OpenBSD: rcctl.sh,v 1.12 2014/08/24 07:33:26 ajacoutot Exp $ # # Copyright (c) 2014 Antoine Jacoutot # @@ -23,7 +23,7 @@ _rc_parse_conf usage() { - _rc_err "usage: ${0##*/} enable|disable|status|action [service | daemon [flags [...]]]" + _rc_err "usage: ${0##*/} [-df] enable|disable|status|action [service | daemon [flags [...]]]" } needs_root() @@ -275,6 +275,16 @@ rm_flags() rcconf_edit_end } +unset _RC_DEBUG _RC_FORCE +while getopts "df" c; do + case "$c" in + d) _RC_DEBUG=-d;; + f) _RC_FORCE=-f;; + *) usage;; + esac +done +shift $((OPTIND-1)) + action=$1 svc=$2 flag=$3 @@ -322,7 +332,7 @@ if [ $# -gt 0 ]; then if svc_is_special $svc; then _rc_err "\"$svc\" is a special variable, no rc.d(8) script" fi - /etc/rc.d/$svc $action + /etc/rc.d/$svc ${_RC_DEBUG} ${_RC_FORCE} $action ;; *) usage -- 2.20.1