summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-08-25 23:15:38 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-08-25 23:15:38 +0000
commit491dd834b62ed9d1031a7de4797d20665dcdb454 (patch)
treec412f40b2862aed91930249619250e2d97edadfc /usr.sbin
parent3277a91997b7e9a6b3166908093338d18089a212 (diff)
Base system special services have no flags, so move the test for them
up front in add_flags(). This avoids unnecessary work, avoids setting bogus variables, and reduces the risk of screwing up things when changing the code. No functional change right now. ok ajacoutot@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rcctl/rcctl.sh22
1 files changed, 13 insertions, 9 deletions
diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh
index 2c5abe19bb5..549d14a9570 100644
--- a/usr.sbin/rcctl/rcctl.sh
+++ b/usr.sbin/rcctl/rcctl.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: rcctl.sh,v 1.26 2014/08/25 21:34:34 schwarze Exp $
+# $OpenBSD: rcctl.sh,v 1.27 2014/08/25 23:15:37 schwarze Exp $
#
# Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org>
#
@@ -198,6 +198,17 @@ add_flags()
{
local _svc=$2
[ -n "${_svc}" ] || return
+
+ if svc_is_special ${_svc}; then
+ rcconf_edit_begin
+ grep -v "^${_svc}.*=" /etc/rc.conf.local >${_TMP_RCCONF}
+ if ! svc_default_enabled ${_svc}; then
+ echo "${_svc}=YES" >>${_TMP_RCCONF}
+ fi
+ rcconf_edit_end
+ return
+ fi
+
local _deflags _flags _numargs=$#
_deflags="$(svc_default_enabled_flags ${_svc})"
@@ -226,14 +237,7 @@ add_flags()
unset _flags
fi
- if svc_is_special ${_svc}; then
- rcconf_edit_begin
- grep -v "^${_svc}.*=" /etc/rc.conf.local >${_TMP_RCCONF}
- if ! svc_default_enabled ${_svc}; then
- echo "${_svc}=YES" >>${_TMP_RCCONF}
- fi
- rcconf_edit_end
- elif svc_is_base ${_svc}; then
+ if svc_is_base ${_svc}; then
rcconf_edit_begin
grep -v "^${_svc}_flags.*=" /etc/rc.conf.local >${_TMP_RCCONF}
if ! svc_default_enabled ${_svc} || test "${#_flags[*]}" -gt 0; then