From cda2c7b1bafbc8190665905caf408402c84d4c07 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 28 Feb 2009 14:50:42 +0000 Subject: improved init script (chroot) --- etc/init.d/uanytun | 8 +++++--- etc/uanytun/p2p-a/config | 4 ++-- etc/uanytun/p2p-b/config | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'etc') 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 # -- cgit v1.2.3