diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-08-29 20:21:14 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-08-29 20:21:14 +0000 |
commit | 066aef1627f7a698bbc61792a56e434d95938699 (patch) | |
tree | 42655e6f7bfc38df6f1b1989c8c6a53e5f2c6925 /usr.sbin/rcctl | |
parent | 342a7265a0c2a8d693857da2f9bf58103777bff2 (diff) |
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@
Diffstat (limited to 'usr.sbin/rcctl')
-rw-r--r-- | usr.sbin/rcctl/rcctl.sh | 10 |
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 } |