openvpn: added rc script, thanks jaeger
This commit is contained in:
parent
7c35db858a
commit
0cc87645dd
@ -1,3 +1,6 @@
|
||||
drwxr-xr-x root/root etc/
|
||||
drwxr-xr-x root/root etc/rc.d/
|
||||
-rwxr-xr-x root/root etc/rc.d/openvpn
|
||||
drwxr-xr-x root/root usr/
|
||||
drwxr-xr-x root/root usr/man/
|
||||
drwxr-xr-x root/root usr/man/man8/
|
||||
|
@ -1 +1,2 @@
|
||||
f8152ae5357778e949c32950874c03ac openvpn
|
||||
c5181e27b7945fa6276d21873329c5c7 openvpn-2.2.2.tar.gz
|
||||
|
@ -6,9 +6,11 @@
|
||||
name=openvpn
|
||||
version=2.2.2
|
||||
release=1
|
||||
source=(http://swupdate.openvpn.net/community/releases/$name-$version.tar.gz)
|
||||
source=(http://swupdate.openvpn.net/community/releases/$name-$version.tar.gz \
|
||||
openvpn)
|
||||
|
||||
build() {
|
||||
install -D -m 755 openvpn $PKG/etc/rc.d/openvpn
|
||||
cd $name-$version
|
||||
|
||||
./configure --prefix=/usr \
|
||||
|
65
openvpn/openvpn
Normal file
65
openvpn/openvpn
Normal file
@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# /etc/rc.d/openvpn: start/stop openvpn daemon
|
||||
#
|
||||
|
||||
CONFDIR=/etc/openvpn
|
||||
RUNDIR=/var/run
|
||||
|
||||
# optional arguments to openvpn
|
||||
OPTARGS="--fast-io"
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [start|stop|restart] <config-name>"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# require a config name to be specified
|
||||
if [ -z "$2" ]
|
||||
then
|
||||
usage
|
||||
fi
|
||||
|
||||
CONF=${CONFDIR}/${2}.conf
|
||||
PID=${RUNDIR}/openvpn.${2}.pid
|
||||
|
||||
# check for the existence of the specified config
|
||||
if [ ! -f ${CONF} ]
|
||||
then
|
||||
echo "Can't find config file ${CONF}! Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
# check for an existing PID; this tunnel may already be running
|
||||
if [ -f ${PID} ]
|
||||
then
|
||||
echo "VPN '${2}' appears to be running already. If not, remove the stale PID file '${PID}'. Exiting."
|
||||
exit 2
|
||||
fi
|
||||
# start the specified VPN config
|
||||
echo "Starting VPN '${2}'..."
|
||||
/usr/sbin/openvpn --config ${CONF} --writepid ${PID} --daemon ovpn-${2} ${OPTARGS}
|
||||
;;
|
||||
stop)
|
||||
# check for an existing PID; this tunnel should already be running
|
||||
if [ ! -f ${PID} ]
|
||||
then
|
||||
echo "VPN '${2}' doesn't appear to be running. Exiting."
|
||||
exit 3
|
||||
fi
|
||||
# stop the specified VPN config
|
||||
echo "Stopping VPN '${2}'..."
|
||||
kill `cat ${PID}`
|
||||
rm -f ${PID}
|
||||
;;
|
||||
restart)
|
||||
${0} stop ${2}; sleep 3; ${0} start ${2}
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
# End of file
|
Loading…
Reference in New Issue
Block a user