summaryrefslogtreecommitdiff
path: root/etc/init.d/uanytun
diff options
context:
space:
mode:
Diffstat (limited to 'etc/init.d/uanytun')
-rwxr-xr-xetc/init.d/uanytun8
1 files changed, 5 insertions, 3 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