summaryrefslogtreecommitdiff
path: root/security/openvpn/files
diff options
context:
space:
mode:
authorMatthias Andree <mandree@FreeBSD.org>2011-08-30 17:11:57 +0000
committerMatthias Andree <mandree@FreeBSD.org>2011-08-30 17:11:57 +0000
commita2cf6822c55e6a28a2b7e1dc9e5ae336f1cd55cb (patch)
tree466b0366a481f160505bd31a2d3d4c3a9c669656 /security/openvpn/files
parentupdate to 0.2.2.32 (diff)
Use required_modules rather than _precmd.
To fix failures with 'restart'. Reported by: Miroslav Lachman
Diffstat (limited to 'security/openvpn/files')
-rw-r--r--security/openvpn/files/openvpn.sh.in24
1 files changed, 8 insertions, 16 deletions
diff --git a/security/openvpn/files/openvpn.sh.in b/security/openvpn/files/openvpn.sh.in
index 6e88286ad51c..d2539131a212 100644
--- a/security/openvpn/files/openvpn.sh.in
+++ b/security/openvpn/files/openvpn.sh.in
@@ -46,6 +46,7 @@
#
# NAME_enable="NO" # set to YES to enable openvpn
# NAME_if= # driver(s) to load, set to "tun", "tap" or "tun tap"
+# # it is OK to specify the if_ prefix.
#
# # optional:
# NAME_flags= # additional command line arguments
@@ -78,19 +79,6 @@ name="${name##*/}"
rcvar=$(set_rcvar)
-openvpn_precmd()
-{
- for i in $interfaces ; do
- if ! sysctl debug.if_${i}_debug >/dev/null 2>&1 ; then
- if ! kldload if_${i} ; then
- warn "Could not load $i module."
- return 1
- fi
- fi
- done
- return 0
-}
-
stop_postcmd()
{
rm -f "$pidfile" || warn "Could not remove $pidfile."
@@ -113,9 +101,7 @@ pidfile="/var/run/${name}.pid"
# command and arguments
command="%%PREFIX%%/sbin/openvpn"
-# run this first
-start_precmd="openvpn_precmd"
-# and this last
+# run this last
stop_postcmd="stop_postcmd"
load_rc_config ${name}
@@ -128,7 +114,13 @@ configfile="$(eval echo \${${name}_configfile})"
dir="$(eval echo \${${name}_dir})"
interfaces="$(eval echo \${${name}_if})"
+required_modules=
+for i in $interfaces ; do
+ required_modules="$required_modules${required_modules:+" "}if_${i#if_}"
+done
+
required_files=${configfile}
+
command_args="--cd ${dir} --daemon ${name} --config ${configfile} --writepid ${pidfile}"
run_rc_command "$1"