summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-06-10 21:53:50 +0200
committermakefu <github@syntax-fehler.de>2013-06-10 21:53:50 +0200
commit3b5802ae97355f8e0b223648c4a6e5bb474100bb (patch)
tree14e1363ceb00f0f798cfc4c45a0ce2479c9ece5c /usr
parent1707fdd4035c776292527e1ae26a7692833ee5ed (diff)
add wifi_init, fix oneshot networks
Diffstat (limited to 'usr')
-rwxr-xr-xusr/bin/autowifi14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr/bin/autowifi b/usr/bin/autowifi
index 36327a29..d9337cf4 100755
--- a/usr/bin/autowifi
+++ b/usr/bin/autowifi
@@ -63,9 +63,10 @@ find_count_of_ssid(){
connect_to_network_by_ssid(){
+ wifi_init
find_count_of_ssid "$1" | (while read i
do
- loop_over_cracks $i
+ loop_over_cracks "$i" && exit 0
done;exit 1)
if [ $? -eq 0 ]; then
exit 0
@@ -75,6 +76,7 @@ connect_to_network_by_ssid(){
}
connect_with_pw(){
+ wifi_init
find_count_of_ssid "$1" | (while read i
do
KEY="$2"
@@ -84,14 +86,16 @@ connect_with_pw(){
fi
done;exit 1)
}
-
-loop_over_networks(){
-
+wifi_init(){
wpa_supplicant_is_usable || start_wpa_supplicant /tmp/autowifi.wpa_supplicant
wifi_scan > /tmp/${interface}.scan
. /tmp/${interface}.scan
+}
+loop_over_networks(){
+ wifi_init
+
for i in `seq 1 $WIFI_COUNT`; do
- loop_over_cracks $i
+ loop_over_cracks "$i"
if [ $? -eq 0 ]; then
return 0
fi