conn

A script repository to manage connections in Linux.
git clone git://r-36.net/conn
Log | Files | Refs | LICENSE

commit f97c5f1f20b3db74df156013a5987c401e896f14
parent 64a4feff7be263c63d7ca438cdef725625788c64
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed, 29 Jun 2011 23:05:01 +0200

Fixing the inheritance problem of wpa_cli.

Diffstat:
etc/conn/common.sh | 10++++------
examples/wifi/wlan0-action.sh | 8+++++---
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/etc/conn/common.sh b/etc/conn/common.sh @@ -107,8 +107,8 @@ getdefaultstate() { startwpa() { PID=`pgrep -f "$WPACMD -i $1"` [ -z "$PID" ] && $WPACMD -i $1 - PID=`pgrep -f "$WPACLICMD -i $1 $WIFIDIR/$1-action.sh"` - [ -z "$PID" ] && $WPACLICMD -i $1 -a $WIFIDIR/$1-action.sh \ + PID=`pgrep -f "$WPACLICMD -i $1 -a $WIFIDIR/$1-action.sh -B"` + [ -z "$PID" ] && $WPACLICMD -i $1 -a $WIFIDIR/$1-action.sh -B \ 2>&1 >/dev/null & } @@ -118,10 +118,8 @@ hupwpa() { } stopwpa() { - PID=`pgrep -f "$WPACMD -i $1"` - [ ! -z "$PID" ] && kill -KILL $PID - PID=`pgrep -f "$WPACLICMD -i $1 $WIFIDIR/$1-action.sh"` - [ ! -z "$PID" ] && kill -KILL $PID + pkill -KILL -f "$WPACMD -i $1" + pkill -KILL -f "$WPACLICMD -i $1 -a $WIFIDIR/$1-action.sh -B" } # $WPA_ID must be set from within the calling action script. diff --git a/examples/wifi/wlan0-action.sh b/examples/wifi/wlan0-action.sh @@ -1,6 +1,8 @@ #!/bin/sh -. ../common.sh +. /etc/conn/common.sh + +WIFIDIR="${ETCDIR}/wifi" interface="$1" action="$2" @@ -11,7 +13,7 @@ ssid="$3" logger -t "$interface-action" "Got request for $interface $ssid $action." getscript() { - awk -F'\t' "/$1\$/ {print \$1}" networks.tbl + awk -F'\t' "/$1\$/ {print \$1}" ${WIFIDIR}/networks.tbl } if [ "$ssid" != "" ]; @@ -41,7 +43,7 @@ then script=`getscript $ssid` if [ "$script" != "" ]; then - cd networks + cd ${WIFIDIR}/networks ./$script $interface $action exit $? fi