]> git.ozlabs.org Git - ppp.git/commitdiff
tidy up shell scripting, common radvd path in examples
authorAlexandr D. Kanevskiy <kad@blackcatlinux.com>
Mon, 12 Apr 2004 05:41:01 +0000 (05:41 +0000)
committerAlexandr D. Kanevskiy <kad@blackcatlinux.com>
Mon, 12 Apr 2004 05:41:01 +0000 (05:41 +0000)
scripts/ipv6-down.sample
scripts/ipv6-up.sample
scripts/pon

index 742bbe53d8069bb7951dd7dc893beb06d51edc6e..bf315747cea5c72d6468323efb6b3c401a576197 100644 (file)
@@ -8,24 +8,24 @@
 # Kill the router advertisement daemon on this interface.
 # The killing procedure is copied from RedHat 6.0 initscripts.
 
-DEVICE=$1
+DEVICE="$1"
 
-PIDFILE=/var/run/radvd-$DEVICE.pid
+PIDFILE="/var/run/radvd-$DEVICE.pid"
 
-[ -f $PIDFILE ] || exit 0
+[ -f "$PIDFILE" ] || exit 0
 
-PID=`cat $PIDFILE`
+PID="$(cat "$PIDFILE")"
 if [ "$PID" != "" ]; then
-    if ps h $PID >/dev/null 2>&1; then
-       kill -TERM $PID
+    if ps h "$PID" >/dev/null 2>&1; then
+       kill -TERM "$PID"
        usleep 10000
-       if ps h $PID >/dev/null 2>&1; then
+       if ps h "$PID" >/dev/null 2>&1; then
            sleep 1
-           if ps h $PID >/dev/null 2>&1; then
-               kill -KILL $PID
+           if ps h "$PID" >/dev/null 2>&1; then
+               kill -KILL "$PID"
            fi
        fi
     fi
 fi
 
-rm -f $PIDFILE
+rm -f "$PIDFILE"
index e880445a65b5d19bdcbae44f4f2c102bf50089ac..0974da941be189df28fef6debad1723bfd419e7b 100644 (file)
@@ -8,26 +8,27 @@
 # Start router advertisements on this link.
 # Based on radvd 0.5.0 behaviour
 
-DEVICE=$1
+DEVICE="$1"
 
-CFGFILE=/usr/inet6/etc/radvd.conf-$DEVICE
-PIDFILE=/var/run/radvd-$DEVICE.pid
+CFGFILE="/etc/radvd.conf-$DEVICE"
+PIDFILE="/var/run/radvd-$DEVICE.pid"
+EXEFILE="/usr/sbin/radvd"
 
-if [ -x /usr/inet6/sbin/radvd && -f $CFGFILE ]; then
-    touch $PIDFILE
-    if [ ! -f $PIDFILE ]; then
+if [ -x "$EXEFILE" -a -f "$CFGFILE" ]; then
+    touch "$PIDFILE"
+    if [ ! -f "$PIDFILE" ]; then
        echo "error: $PIDFILE is not a regular file. Aborting"
        exit 0
     fi
 
-    PID=`cat $PIDFILE`
-    if [ "$PID" != "" ]; then
-       ps h $PID >/dev/null 2>&1 && exit 0
+    PID="$(cat "$PIDFILE")"
+    if [ -n "$PID" ]; then
+       ps h "$PID" >/dev/null 2>&1 && exit 0
     fi
 
     # radvd 0.5.0 doesn't write a pid-file so we do it here
     # enabling debugging keeps radvd in foreground, putting it
     # on background gives us the PID.
-    /usr/inet6/sbin/radvd -d 1 -C $CFGFILE &
-    echo $! >$PIDFILE
+    "$EXEFILE" -d 1 -C "$CFGFILE" &
+    echo $! >"$PIDFILE"
 fi
index 6117fa8f63aaffb90757f786193f24ad59ad3e29..ef47518c879716c50fb3948bfbcbf428e222cf4d 100644 (file)
@@ -1,10 +1,12 @@
 #!/bin/sh
 
+PPP_ON_BOOT=/etc/ppp/ppp_on_boot
+
 case "$1" in
   -*) echo "
 Usage: pon [provider] [arguments]
 
-If pon is invoked without arguments, /etc/ppp/ppp_on_boot file will be
+If pon is invoked without arguments, $PPP_ON_BOOT file will be
 run, presuming it exists and is executable. Otherwise, a PPP connection
 will be started using settings from /etc/ppp/peers/provider.
 If you specify one argument, a PPP connection will be started using
@@ -16,8 +18,8 @@ pppd.
       ;;
 esac
 
-if [ -z "$1" -a -x /etc/ppp/ppp_on_boot ]; then
-  exec /etc/ppp/ppp_on_boot
+if [ -z "$1" -a -x "$PPP_ON_BOOT" ]; then
+  exec "$PPP_ON_BOOT"
 fi
 
 if [ -z "$1" -a ! -f /etc/ppp/peers/provider ]; then