summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-06-10 21:21:10 +0200
committermakefu <github@syntax-fehler.de>2013-06-10 21:21:10 +0200
commit9f2394c6254593eac25a568f5fddb9b672f2abc4 (patch)
treea0783dd5131a24eed32dc6f2374163225f05577c
parent3fa01e1d01e3235e218370f3afd3f2f2344c8b01 (diff)
autowifi is now enterprise
-rwxr-xr-xusr/bin/autowifi13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr/bin/autowifi b/usr/bin/autowifi
index 19eabffd..36327a29 100755
--- a/usr/bin/autowifi
+++ b/usr/bin/autowifi
@@ -1,4 +1,4 @@
-#!/bin/sh -x
+#!/bin/sh
cd $(dirname $(readlink -f $0))
@@ -18,7 +18,6 @@ wifi_log=$root/var/log/autowifi.log
. $root/usr/lib/autowifi/lib/wpa_supplicant
-
connect(){
#mac ssid encryption key
@@ -87,10 +86,14 @@ connect_with_pw(){
}
loop_over_networks(){
+
+ wpa_supplicant_is_usable || start_wpa_supplicant /tmp/autowifi.wpa_supplicant
+ wifi_scan > /tmp/${interface}.scan
+ . /tmp/${interface}.scan
for i in `seq 1 $WIFI_COUNT`; do
loop_over_cracks $i
if [ $? -eq 0 ]; then
- exit 0
+ return 0
fi
done
}
@@ -140,9 +143,6 @@ loop_over_cracks(){
-start_wpa_supplicant /tmp/autowifi.wpa_supplicant
-wifi_scan > /tmp/${interface}.scan
-. /tmp/${interface}.scan
if [ -n "$2" ]; then
echo connecting to $1 with pw $2
connect_with_pw "$1" "$2"
@@ -152,6 +152,7 @@ elif [ -n "$1" ]; then
else
echo looping network now
check_internet || loop_over_networks
+
while sleep 60; do
if ! check_internet; then
loop_over_networks