diff options
author | Robert Peichaer <rpe@cvs.openbsd.org> | 2014-10-27 21:24:27 +0000 |
---|---|---|
committer | Robert Peichaer <rpe@cvs.openbsd.org> | 2014-10-27 21:24:27 +0000 |
commit | 080c41521661ceeb012220990b166a34b9744da4 (patch) | |
tree | a5067e5dbfb5d54ad6208bdce6736df2e1e8325d | |
parent | 2a3a5a4efcbe286f78350e3b6460198b30b7a6a6 (diff) |
Ensure proper separation of grep's options and rcctl options that
may end up in ${svc} by mistake.
OK ajacoutot@
-rw-r--r-- | usr.sbin/rcctl/rcctl.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh index 30a0f0d4ad2..f74fd2c6ebe 100644 --- a/usr.sbin/rcctl/rcctl.sh +++ b/usr.sbin/rcctl/rcctl.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: rcctl.sh,v 1.45 2014/10/15 07:38:24 ajacoutot Exp $ +# $OpenBSD: rcctl.sh,v 1.46 2014/10/27 21:24:26 rpe Exp $ # # Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org> # Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -123,7 +123,7 @@ svc_get_flags() else # set pkg daemon_flags to "NO" to match base svc if ! svc_is_base ${_svc}; then - if ! echo ${pkg_scripts} | grep -qw ${_svc}; then + if ! echo ${pkg_scripts} | grep -qw -- ${_svc}; then echo "NO" && return fi fi @@ -168,7 +168,7 @@ svc_is_base() local _svc=$1 [ -n "${_svc}" ] || return - grep "^start_daemon " /etc/rc | cut -d ' ' -f2- | grep -qw ${_svc} + grep "^start_daemon " /etc/rc | cut -d ' ' -f2- | grep -qw -- ${_svc} } svc_is_enabled() @@ -184,7 +184,7 @@ svc_is_special() local _svc=$1 [ -n "${_svc}" ] || return - echo ${_special_services} | grep -qw ${_svc} + echo ${_special_services} | grep -qw -- ${_svc} } append_to_pkg_scripts() @@ -195,7 +195,7 @@ append_to_pkg_scripts() rcconf_edit_begin if [ -z "${pkg_scripts}" ]; then echo pkg_scripts="${_svc}" >>${_TMP_RCCONF} - elif ! echo ${pkg_scripts} | grep -qw ${_svc}; then + 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} fi |