summaryrefslogtreecommitdiff
path: root/etc/init.d
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-02-28 14:50:42 +0000
committerChristian Pointner <equinox@anytun.org>2009-02-28 14:50:42 +0000
commitcda2c7b1bafbc8190665905caf408402c84d4c07 (patch)
treedd5b97c533fd0a72962950745557b1dc8a4aa696 /etc/init.d
parentadded adduser and deluser to insatll target (diff)
improved init script (chroot)
Diffstat (limited to 'etc/init.d')
-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