summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorlassulus <lassulus@googlemail.com>2013-05-23 20:01:40 +0200
committerlassulus <lassulus@googlemail.com>2013-05-23 20:01:40 +0200
commit640e5c566585c04bfa4cdfbf8d89c34d8626108f (patch)
treef1b2387b8fb0120efb915da9ed8f854ad5cf9df7 /usr
parent116467f9bb2d28666045fda00ef19dcef9558331 (diff)
autowifi with connect_function now
Diffstat (limited to 'usr')
-rwxr-xr-x[-rw-r--r--]usr/bin/autowifi16
1 files changed, 15 insertions, 1 deletions
diff --git a/usr/bin/autowifi b/usr/bin/autowifi
index 9ccff4b7..876dbc15 100644..100755
--- a/usr/bin/autowifi
+++ b/usr/bin/autowifi
@@ -1,3 +1,17 @@
-#!/usr/bin/sh
+#!/bin/sh -x
+iface=@wifi-iface[0]
+radio=$(uci get wireless.${iface}.device)
connect_wifi(){
+ ifconfig wlan0 up
+ uci set wireless.${radio}.channel=$1
+ uci set "wireless.${iface}.ssid=$2"
+ if [ $3 == "none" ] ; then
+ uci set wireless.${iface}.encryption=none
+ uci -q delete wireless.${iface}.key
+ else
+ uci set "wireless.${iface}.key=$4"
+ uci set wireless.${iface}.encryption=$3
+ fi
+ wifi up
}
+connect_wifi "$@"