diff options
author | lassulus <lassulus@googlemail.com> | 2013-06-10 21:24:04 +0200 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-06-10 21:24:04 +0200 |
commit | af16433b46f5c60fc5153141d8d5f336c076160c (patch) | |
tree | 131dac2919ad75337df6bc9f22c863c75a8e7c2e /usr/bin | |
parent | 2bcd40a23f5f326b7f332b22fb8633bc5f88003c (diff) | |
parent | 2ffb00bd97e0e8b47dc1def6f47ebc5295107360 (diff) |
Merge branch 'master' of github.com:krebscode/autowifi
Diffstat (limited to 'usr/bin')
-rwxr-xr-x | usr/bin/autowifi | 13 |
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 |