Use recently bugfixed rc script from ../openvpn port.

This commit is contained in:
Matthias Andree 2011-08-30 17:12:31 +00:00
parent a2cf6822c5
commit 2a9cbca0a0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=280781
2 changed files with 21 additions and 20 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= openvpn
PORTVERSION= 2.0.9
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= security net
# MASTER_SITES points to hosts in distinct data centers,
# so just one MASTER_SITES entry should be OK.

View file

@ -2,10 +2,11 @@
#
# openvpn.sh - load tun/tap driver and start OpenVPN daemon
#
# (C) Copyright 2005 - 2008 by Matthias Andree
# (C) Copyright 2005 - 2008, 2010 by Matthias Andree
# based on suggestions by Matthias Grimm and Dirk Gouders
# with multi-instance contribution from Denis Shaposhnikov, Gleb Kozyrev
# and Vasil Dimov
# softrestart feature suggested by Nick Hibma
#
# $FreeBSD$
#
@ -45,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
@ -77,26 +79,21 @@ 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."
}
# support SIGHUP to reparse configuration file
extra_commands="reload"
softrestart()
{
sig_reload=USR1 run_rc_command reload
exit $?
}
# reload: support SIGHUP to reparse configuration file
# softrestart: support SIGUSR1 to reconnect without superuser privileges
extra_commands="reload softrestart"
softrestart_cmd="softrestart"
# pidfile
pidfile="/var/run/${name}.pid"
@ -104,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}
@ -119,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"