summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-08-29 20:21:13 +0000
committerschwarze <schwarze@openbsd.org>2014-08-29 20:21:13 +0000
commit13940451a80766efdd6e7023647bcc3805c5ea97 (patch)
tree6defe12e4a2a3f41b5254a57c9942d9028c7b168
parentFix checking sync for old synaptics touchpad (ver 5.9) (diff)
downloadwireguard-openbsd-13940451a80766efdd6e7023647bcc3805c5ea97.tar.xz
wireguard-openbsd-13940451a80766efdd6e7023647bcc3805c5ea97.zip
Simplify append_to_pkg_scripts(), in particular avoid the expensive
svc_is_enabled() and look at ${pkg_scripts} only, flags are not relevant to this function. "please commit" ajacoutot@
-rw-r--r--usr.sbin/rcctl/rcctl.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh
index c218d7b3136..ba4c7ee658f 100644
--- a/usr.sbin/rcctl/rcctl.sh
+++ b/usr.sbin/rcctl/rcctl.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: rcctl.sh,v 1.32 2014/08/28 14:51:16 ajacoutot Exp $
+# $OpenBSD: rcctl.sh,v 1.33 2014/08/29 20:21:13 schwarze Exp $
#
# Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org>
#
@@ -161,14 +161,12 @@ append_to_pkg_scripts()
local _svc=$1
[ -n "${_svc}" ] || return
- svc_is_enabled ${_svc} && return
-
rcconf_edit_begin
- if [ -n "${pkg_scripts}" ]; then
+ if [ -z "${pkg_scripts}" ]; then
+ echo pkg_scripts="${_svc}" >>${_TMP_RCCONF}
+ elif ! echo ${pkg_scripts} | grep -qw ${_svc}; then
grep -v "^pkg_scripts.*=" /etc/rc.conf.local >${_TMP_RCCONF}
echo pkg_scripts="${pkg_scripts} ${_svc}" >>${_TMP_RCCONF}
- else
- echo pkg_scripts="${_svc}" >>${_TMP_RCCONF}
fi
rcconf_edit_end
}