wok-current rev 15885

pppd: add /etc/ppp/ip-up.d & /etc/ppp/ip-down.d
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 08 13:29:05 2014 +0000 (2014-02-08)
parents 36e9807432da
children 31599711e814
files ppp/receipt tinc/receipt tinc/stuff/etc/init.d/tinc
line diff
     1.1 --- a/ppp/receipt	Fri Feb 07 12:29:13 2014 +0000
     1.2 +++ b/ppp/receipt	Sat Feb 08 13:29:05 2014 +0000
     1.3 @@ -44,7 +44,7 @@
     1.4  	cp -a $install/usr/sbin $fs/usr
     1.5  	cp -a $install/usr/lib $fs/usr
     1.6  	# Config files.
     1.7 -	mkdir -p $fs/etc/ppp/scripts
     1.8 +	mkdir -p $fs/etc/ppp/scripts $fs/etc/ppp/ip-up.d $fs/etc/ppp/ip-down.d
     1.9  	cp $stuff/README.scripts $fs/etc/ppp
    1.10  	cp -a $src/etc.ppp/* $fs/etc/ppp
    1.11  
    1.12 @@ -57,7 +57,9 @@
    1.13  	cp -a $src/scripts/callback $fs/etc/ppp/scripts
    1.14  	cp -a $src/scripts/redialer $fs/etc/ppp/scripts
    1.15  	cat >> $fs/etc/ppp/ip-up <<EOT
    1.16 -if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
    1.17 +if [ -x /etc/ppp/ip-up.d/\$6 ]; then
    1.18 +	. /etc/ppp/ip-up.d/\$6 "\$@"
    1.19 +elif [ -n "\$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
    1.20  	rm -f /etc/ppp/resolv.prev
    1.21  	if [ -f /etc/resolv.conf ]; then
    1.22  		cp /etc/resolv.conf /etc/ppp/resolv.prev
    1.23 @@ -72,7 +74,9 @@
    1.24  fi
    1.25  EOT
    1.26  	cat >> $fs/etc/ppp/ip-down <<EOT
    1.27 -if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
    1.28 +if [ -x /etc/ppp/ip-down.d/\$6 ]; then
    1.29 +	. /etc/ppp/ip-down.d/\$6 "\$@"
    1.30 +elif [ -n "\$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
    1.31  	if [ -f /etc/ppp/resolv.prev ]; then
    1.32  		cp -f /etc/ppp/resolv.prev /etc/resolv.conf
    1.33  		chmod 644 /etc/resolv.conf
    1.34 @@ -83,7 +87,7 @@
    1.35  EOT
    1.36  	# cp -a $src/scripts/ip-up.local.add $fs/etc/ppp/ip-up
    1.37  	# cp -a $src/scripts/ip-down.local.add $fs/etc/ppp/ip-down
    1.38 -	chmod 711 $fs/etc/ppp/ip*
    1.39 +	chmod 711 $fs/etc/ppp/ip-up $fs/etc/ppp/ip-down
    1.40  
    1.41  	# insert #!/bin/sh  on top line in ip* scripts
    1.42  	sed -i '1i\#!/bin/sh' $fs/etc/ppp/ip*	
     2.1 --- a/tinc/receipt	Fri Feb 07 12:29:13 2014 +0000
     2.2 +++ b/tinc/receipt	Sat Feb 08 13:29:05 2014 +0000
     2.3 @@ -32,5 +32,6 @@
     2.4  {
     2.5  	mkdir -p $fs/usr
     2.6  	cp -a $install/usr/sbin $fs/usr
     2.7 +	cp -a $stuff/* $fs
     2.8  }
     2.9  
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tinc/stuff/etc/init.d/tinc	Sat Feb 08 13:29:05 2014 +0000
     3.3 @@ -0,0 +1,55 @@
     3.4 +#!/bin/sh
     3.5 +# /etc/init.d/tinc: Start, stop and restart tinc deamon on SliTaz, at boot
     3.6 +# time or with the command line.
     3.7 +#
     3.8 +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     3.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    3.10 +#
    3.11 +. /etc/init.d/rc.functions
    3.12 +. /etc/daemons.conf
    3.13 +
    3.14 +NAME=tinc
    3.15 +DESC="tinc deamon"
    3.16 +DAEMON=/usr/sbin/tincd
    3.17 +OPTIONS=$TINC_OPTIONS
    3.18 +PIDFILE=/var/run/tinc.pid
    3.19 +
    3.20 +case "$1" in
    3.21 +  start)
    3.22 +    if active_pidfile $PIDFILE tincd ; then
    3.23 +      echo "$NAME already running."
    3.24 +      exit 1
    3.25 +    fi
    3.26 +    echo -n "Starting $DESC: $NAME... "
    3.27 +    $DAEMON $OPTIONS 
    3.28 +    status
    3.29 +    ;;
    3.30 +  stop)
    3.31 +    if ! active_pidfile $PIDFILE tincd ; then
    3.32 +      echo "$NAME is not running."
    3.33 +      exit 1
    3.34 +    fi
    3.35 +    echo -n "Stopping $DESC: $NAME... "
    3.36 +    $DAEMON -k 
    3.37 +    status
    3.38 +    ;;
    3.39 +  restart)
    3.40 +    if ! active_pidfile $PIDFILE tincd ; then
    3.41 +      echo "$NAME is not running."
    3.42 +      exit 1
    3.43 +    fi
    3.44 +    echo -n "Restarting $DESC: $NAME... "
    3.45 +    $DAEMON -k 
    3.46 +    sleep 2
    3.47 +    $DAEMON $OPTIONS
    3.48 +    status
    3.49 +    ;;
    3.50 +  *)
    3.51 +    echo ""
    3.52 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|reload|restart]"
    3.53 +    echo ""
    3.54 +    exit 1
    3.55 +    ;;
    3.56 +esac
    3.57 +
    3.58 +exit 0