Fixing debugging and the example wifi. - conn - A script repository to manage connections in Linux.
Log
Files
Refs
LICENSE
---
commit bcf27847d7146a104d12381e55261d5d0609b342
parent 37b3408b3861633fbf9d25f08b635621885c3309
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed, 23 Feb 2011 09:47:53 +0100

Fixing debugging and the example wifi.

Diffstat:
  etc/conn/common.sh                  |      10 ++++++----
  etc/conn/wifi/networks/skkmswp.sh   |       6 +++---

2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/etc/conn/common.sh b/etc/conn/common.sh
@@ -1,6 +1,9 @@
 #!/bin/sh
 
-LOGGING=1
+LOGGING=0
+DEBUG=0
+
+t[ $DEBUG -eq 1 ] && set -x
 
 ## Common dirs
 RUNDIR="/var/run/conn"
@@ -28,8 +31,8 @@ WPACLIREQ="/usr/sbin/wpa_cli"
 
 startwpa() {
         $WPACMD -P $WPAPID.$1 -i $1
-        $WPACLICMD -P $WPACLIPID.$1 -i $1 -a \
-                $WIFIDIR/$1-action.sh 2>&1 >/dev/null &
+        $WPACLICMD -i $1 -a $WIFIDIR/$1-action.sh 2>&1 >/dev/null &
+        echo $! > $WPACLIPID.$1
 }
 
 hupwpa() {
@@ -81,7 +84,6 @@ PINGHOST="8.8.8.8"
 PINGCMD="/bin/ping -q"
 startpingd() {
         $PINGCMD $PINGHOST 2>&1 >/dev/null &
-
         echo $! > $PINGPID.$1
 }
 
diff --git a/etc/conn/wifi/networks/skkmswp.sh b/etc/conn/wifi/networks/skkmswp.sh
@@ -5,12 +5,12 @@ interface="$1"
 case "$2" in
         CONNECTED)
                 ip addr add 192.168.1.6/24 dev $interface \
-                        brd 192.168.1.255
-                ip route add default via 192.168.1.2
+                        brd 192.168.1.255 2>&1 >/dev/null
+                ip route add default via 192.168.1.2 2>&1 >/dev/null
                 echo "nameserver 8.8.8.8" > /etc/resolv.conf
                 ;;
         DISCONNECTED)
-                ip addr del 192.168.1.6/24 dev $interface
+                ip addr del 192.168.1.6/24 dev $interface 2>&1 >/dev/null
                 ;;
         *)
                 exit 1;