summaryrefslogtreecommitdiff
path: root/usr.sbin/rcctl/rcctl.sh
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2015-10-31 11:09:42 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2015-10-31 11:09:42 +0000
commitfac7d138a65f9c9bfe7156a5e43f7c5393e46293 (patch)
treefd88e21c3c59f82ebea35de08c450874f5a0ea49 /usr.sbin/rcctl/rcctl.sh
parentc9f140183e11b2d8d4b0eb894c8cbba010ad826d (diff)
Only handle meta scripts for rc.d actions and enable/disable only.
ok sthen@
Diffstat (limited to 'usr.sbin/rcctl/rcctl.sh')
-rw-r--r--usr.sbin/rcctl/rcctl.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh
index ac86951d95b..0f4587d27a8 100644
--- a/usr.sbin/rcctl/rcctl.sh
+++ b/usr.sbin/rcctl/rcctl.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: rcctl.sh,v 1.83 2015/10/24 13:57:24 ajacoutot Exp $
+# $OpenBSD: rcctl.sh,v 1.84 2015/10/31 11:09:41 ajacoutot Exp $
#
# Copyright (c) 2014, 2015 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -152,6 +152,14 @@ svc_is_base()
cut -d ' ' -f2- | grep -qw -- ${_svc}
}
+svc_is_meta()
+{
+ local _svc=$1
+ [ -n "${_svc}" ] || return
+
+ grep -q "^_pkg_scripts=" /etc/rc.d/${_svc}
+}
+
svc_is_special()
{
local _svc=$1
@@ -457,6 +465,8 @@ case ${action} in
[ -z "${svc}" ] && usage
svc_is_avail ${svc} || \
rcctl_err "service ${svc} does not exist" 2
+ svc_is_meta ${svc} && \
+ rcctl_err "\"${svc}\" is a meta script, cannot \"${action} ${svc} ${var}\""
if [ -n "${var}" ]; then
[[ ${var} != @(class|flags|status|timeout|user) ]] && usage
if svc_is_special ${svc}; then
@@ -473,6 +483,8 @@ case ${action} in
[ -z "${svc}" ] && usage
svc_is_avail ${svc} || \
rcctl_err "service ${svc} does not exist" 2
+ svc_is_meta ${svc} && \
+ rcctl_err "\"${svc}\" is a meta script, cannot \"${action} ${svc} ${var}\""
[[ ${var} != @(class|flags|status|timeout|user) ]] && usage
[[ ${var} = flags && ${args} = NO ]] && \
rcctl_err "\"flags NO\" contradicts \"${action}\""