summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorBernhard Tittelbach <service-anytun@tittelbach.org>2015-01-16 00:13:27 +0000
committerBernhard Tittelbach <service-anytun@tittelbach.org>2015-01-16 00:13:27 +0000
commit3de5d986dc5cebf31287d1c41388a1004976df7d (patch)
treed3acbf5aaf350354fd11ca833c85ae2b315f671b /etc
parentversion output now includes compiler version (diff)
systemd support (--with-systemd) (config/install script untested)
Diffstat (limited to 'etc')
-rwxr-xr-xetc/init.d/anytun33
1 files changed, 3 insertions, 30 deletions
diff --git a/etc/init.d/anytun b/etc/init.d/anytun
index 6905c67..aa5f0af 100755
--- a/etc/init.d/anytun
+++ b/etc/init.d/anytun
@@ -9,17 +9,13 @@
# Description: Enables networking over vpn tunnel interfaces
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/sbin/anytun
-ANYTUNCONFIG=/usr/bin/anytun-config
-CONTROLDAEMON=/usr/bin/anytun-controld
+ANYTUNLAUNCHER=/usr/bin/anytun-launcher.sh
NAME=anytun
DESC=anytun
CONFIG_DIR=/etc/anytun
VARCONFIG_DIR=/var/run/anytun-controld
VARRUN_DIR=/var/run/$NAME/
-test -x $DAEMON || exit 0
-
# Include anytun defaults if available
if [ -f /etc/default/anytun ] ; then
. /etc/default/anytun
@@ -28,16 +24,7 @@ fi
start_vpn () {
STATUS="OK"
if [ -f $CONFIG_DIR/$NAME/config ] ; then
- POSTUP=''
- test -f $CONFIG_DIR/$NAME/post-up.sh && POSTUP="-x $CONFIG_DIR/$NAME/post-up.sh"
- CHROOTDIR=`grep '^chroot' < $CONFIG_DIR/$NAME/config | sed 's/chroot\s*//'`
- if [ -n "$CHROOTDIR" ] ; then
- test -d $CHROOTDIR || mkdir -p $CHROOTDIR
- fi
- test -d $VARRUN_DIR || mkdir -p $VARRUN_DIR
- DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '`
- $DAEMON --write-pid $VARRUN_DIR/$NAME.pid $POSTUP \
- $DAEMONOPTS $DAEMONARG || STATUS="FAILED"
+ $ANYTUNLAUNCHER vpn || STATUS="FAILED"
else
STATUS="no config found"
fi
@@ -51,21 +38,7 @@ stop_vpn () {
}
start_configd () {
- if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then
- test -d $VARCONFIG_DIR || mkdir -p $VARCONFIG_DIR
- chmod 700 $VARCONFIG_DIR
- rm -f $VARCONFIG_DIR/$NAME 2>/dev/null
- KDPRF=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e 'kd-prf' | sed 's/^/ --/' | xargs echo`
- for CLIENTNAME in `ls $CONFIG_DIR/$NAME/conf.d`; do
- echo -n " ($CLIENTNAME)"
- DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/conf.d/$CLIENTNAME | grep -e '\w' | sed 's/^/ --/' | xargs echo`
- $ANYTUNCONFIG $DAEMONARG $CIPHER $AUTHALGO $KDPRF >> $VARCONFIG_DIR/$NAME
- done
- CONTROLHOST=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e 'control-host' | sed 's/^/ --/' | xargs echo`
- $CONTROLDAEMON -f $VARCONFIG_DIR/$NAME $DAEMONOPTS $CONTROLHOST \
- --write-pid $VARCONFIG_DIR/$NAME.pid
- # rm -f $VARCONFIG_DIR/$NAME
- fi
+ $ANYTUNLAUNCHER configd
}
stop_configd () {
if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then