This commit is contained in:
Tyler Bean 2018-11-02 11:42:49 -05:00
parent efa5d6b984
commit 76014255de
2 changed files with 12 additions and 18 deletions

View File

@ -13,7 +13,7 @@ function pingcheck {
}
function am_i_connected {
check=$(nmcli -f NAME,DEVICE c | sift '@Wireless' | wc -l)
check=$(nmcli -f NAME,DEVICE c show --active | sift '@Wireless' | wc -l)
if [[ $check != 0 ]]; then
echo true
fi
@ -32,8 +32,11 @@ function bring_it_down {
}
function bring_it_up {
MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
passwrd_file=$MY_PATH/passwd
UUID=$(nmcli -f NAME,UUID c | sift '@Wireless' | awk '{print $2}')
nmcli c up $UUID passwd-file $passwd
nmcli c up $UUID passwd-file $passwrd_file
}
function spoofy_doof {
@ -51,10 +54,7 @@ function reboot_router {
}
function fixit {
MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
passwd=$MY_PATH/passwd
if [[ $(am_i_connected) != true ]]; then
if [[ $(am_i_connected_to_something) == true ]]; then
bring_it_down
@ -68,18 +68,12 @@ function fixit {
spoofy_doof
bring_it_up
if [[ $(am_i_connected) != true ]]; then
i=0
until [ $i == 20 ]; do
if [[ $(am_i_connected == true) ]]; then
continue
else
sleep 5
bring_it_up
((i++))
fi
done
fi
i=0
until [[ $(am_i_connected) == true || $i == 20 ]]; do
sleep 5
bring_it_up
((i++))
done
}
pingcheck