summaryrefslogtreecommitdiff
path: root/usr.sbin/rcctl
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2014-08-25 21:06:47 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2014-08-25 21:06:47 +0000
commit26af4bd2d61b6690fb0e421b736ac843ff62847d (patch)
treeb852ecad1cbaf8f5fffe92b7471d7a81550ed0af /usr.sbin/rcctl
parentc7d560808d75926ae80e3a92d38af63cfcb01b69 (diff)
rc.d scripts are shell scripts and need to be sourced in svc_get_flags().
It's the only way to get daemon_flags in case it contains line continuation... We only need to do that for enable package scripts. original idea from Sebastien Marie discussed with, input from and ok schwarze@
Diffstat (limited to 'usr.sbin/rcctl')
-rw-r--r--usr.sbin/rcctl/rcctl.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh
index 8c58a01bd33..880dc7a6be9 100644
--- a/usr.sbin/rcctl/rcctl.sh
+++ b/usr.sbin/rcctl/rcctl.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: rcctl.sh,v 1.24 2014/08/25 19:01:26 ajacoutot Exp $
+# $OpenBSD: rcctl.sh,v 1.25 2014/08/25 21:06:46 ajacoutot Exp $
#
# Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org>
#
@@ -101,8 +101,15 @@ svc_get_flags()
fi
[ -z "${daemon_flags}" ] && \
daemon_flags="$(eval echo \${${_svc}_flags})"
+ # rc.d shell script: no other way to get "${daemon_flags}"
[ -z "${daemon_flags}" ] && \
- eval $(grep '^daemon_flags=' /etc/rc.d/${_svc})
+ daemon_flags=$(
+ FUNCS_ONLY=1
+ rc_cmd() { }
+ . /etc/rc.d/${_svc} >/dev/null 2>&1
+ echo ${daemon_flags}
+ )
+
echo ${daemon_flags} | sed '/^$/d'
fi
}