summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xetc/init.d/uanytun8
-rw-r--r--etc/uanytun/p2p-a/config4
-rw-r--r--etc/uanytun/p2p-b/config4
3 files changed, 9 insertions, 7 deletions
diff --git a/etc/init.d/uanytun b/etc/init.d/uanytun
index 518b5c6..781e809 100755
--- a/etc/init.d/uanytun
+++ b/etc/init.d/uanytun
@@ -10,7 +10,6 @@
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/uanytun
-CHROOTDIR='/var/run/uanytun'
CONFIG_DIR=/etc/uanytun
NAME=uanytun
DESC=uanytun
@@ -27,7 +26,11 @@ start_vpn () {
if [ -f $CONFIG_DIR/$NAME/config ] ; then
POSTUP=''
test -f $CONFIG_DIR/$NAME/post-up.sh && POSTUP="-x $CONFIG_DIR/$NAME/post-up.sh"
- DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '`
+ CHROOTDIR=`grep '^chroot' < $CONFIG_DIR/$NAME/config | sed 's/chroot\s*//'`
+ if [ -n "$CHROOTDIR" ] ; then
+ test -d $CHROOTDIR || mkdir -p $CHROOTDIR
+ fi
+ DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '`
$DAEMON --write-pid /var/run/uanytun.$NAME.pid $POSTUP $DAEMONARG || STATUS="FAILED"
else
STATUS="no config found"
@@ -43,7 +46,6 @@ set -e
case "$1" in
start)
echo -n "Starting $DESC:"
- test -d $CHROOTDIR || mkdir -p $CHROOTDIR
if test -z "$2" ; then
if [ -f $CONFIG_DIR/autostart ] ; then
for NAME in `sed 's/#.*//' < $CONFIG_DIR/autostart | grep -e '\w'`; do
diff --git a/etc/uanytun/p2p-a/config b/etc/uanytun/p2p-a/config
index e5e561f..64f82ad 100644
--- a/etc/uanytun/p2p-a/config
+++ b/etc/uanytun/p2p-a/config
@@ -31,11 +31,11 @@ passphrase Creating_P2P_VPN_Tunnels_With_Anytun_Is_Easy
## local port to bind to (for tunnel data)
## make sure to use a different port for every server and client!
-port 4444
+port 4445
## The remote host and port
remote-host p2p-b.example.com
-remote-port 4444
+remote-port 4445
#############################
## Debug options #
diff --git a/etc/uanytun/p2p-b/config b/etc/uanytun/p2p-b/config
index 4d9d417..4b611d2 100644
--- a/etc/uanytun/p2p-b/config
+++ b/etc/uanytun/p2p-b/config
@@ -31,11 +31,11 @@ passphrase Creating_P2P_VPN_Tunnels_With_Anytun_Is_Easy
## local port to bind to (for tunnel data)
## make sure to use a different port for every server and client!
-port 4444
+port 4445
## The remote host and port
remote-host p2p-a.example.com
-remote-port 4444
+remote-port 4445
#############################
## Debug options #