run.sh (918B)
1 #!/bin/sh 2 3 . ../common.sh 4 5 interface=$2 6 [ -z "$2" ] && interface="wlan0" 7 8 case "$1" in 9 -s) 10 if isblocked "wifi"; 11 then 12 if [ $DOUNBLOCK -eq 1 ]; 13 then 14 dounblock "wifi" 15 else 16 syslog -s -t "wifi-init" "Your wifi device" \ 17 "seems to be blocked. Please use" \ 18 "rfkill to unblock it." 19 exit 1 20 fi 21 fi 22 23 if ! islinkup $interface; 24 then 25 setlinkup $interface 26 fi 27 startwpa $interface 28 exit $? 29 ;; 30 -k) 31 if [ -x "$WIFIDIR/$interface-action.sh" ]; 32 then 33 $WIFIDIR/$interface-action.sh $interface DISCONNECTED 34 fi 35 stopwpa $interface 36 37 islinkup $interface && setlinkdown $interface 38 39 if [ $DOBLOCK -eq 1 ] && ! isblocked "wifi"; 40 then 41 doblock "wifi" 42 fi 43 exit $? 44 ;; 45 -u) 46 hupwpa $interface 47 exit $? 48 ;; 49 -o) 50 exit iswparunning $interface 51 ;; 52 -r) 53 $0 -k $interface; 54 $0 -s $interface; 55 ;; 56 *) 57 echo "usage: $0 [-s|-k|-u|-r] interface" 58 exit 1 59 ;; 60 esac 61 exit 0 62