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 { 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 if [[ $check != 0 ]]; then
echo true echo true
fi fi
@ -32,8 +32,11 @@ function bring_it_down {
} }
function bring_it_up { 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}') 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 { function spoofy_doof {
@ -51,9 +54,6 @@ function reboot_router {
} }
function fixit { 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) != true ]]; then
if [[ $(am_i_connected_to_something) == true ]]; then if [[ $(am_i_connected_to_something) == true ]]; then
@ -68,18 +68,12 @@ function fixit {
spoofy_doof spoofy_doof
bring_it_up bring_it_up
if [[ $(am_i_connected) != true ]]; then i=0
i=0 until [[ $(am_i_connected) == true || $i == 20 ]]; do
until [ $i == 20 ]; do sleep 5
if [[ $(am_i_connected == true) ]]; then bring_it_up
continue ((i++))
else done
sleep 5
bring_it_up
((i++))
fi
done
fi
} }
pingcheck pingcheck