summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajacoutot <ajacoutot@openbsd.org>2014-08-25 21:06:46 +0000
committerajacoutot <ajacoutot@openbsd.org>2014-08-25 21:06:46 +0000
commit760663e8abaa924563ae2e1a8e57ef67c23cbd2e (patch)
tree804a10f5a0aafb770730ac2340549a29bb1d8288
parentDocument the IPv4/IPv6 command line switches and protocol loghost (diff)
downloadwireguard-openbsd-760663e8abaa924563ae2e1a8e57ef67c23cbd2e.tar.xz
wireguard-openbsd-760663e8abaa924563ae2e1a8e57ef67c23cbd2e.zip
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@
-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
}