diff options
-rwxr-xr-x | mining/bin/ensure-wlan0 | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/mining/bin/ensure-wlan0 b/mining/bin/ensure-wlan0 index 77587156..fa92c4f5 100755 --- a/mining/bin/ensure-wlan0 +++ b/mining/bin/ensure-wlan0 @@ -2,7 +2,7 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then echo "we're going sudo..." >&2 - exec sudo "$0" "$@" + exec sudo -E "$0" "$@" exit 23 # go to hell fi @@ -10,15 +10,16 @@ has_internet() { curl -sS google.com >/dev/null } -if ! has_internet; then +if test "${force-false}" = true || ! has_internet; then - ## get rid of the nightmare applet - pkill -9 nm-applet - if test -x "`type -p nm-applet`"; then - rm -vf "`type -p nm-applet`" - fi + ## get rid of the fuckers + for fucker in NetworkManager nm-applet; do + pkill -9 $fucker + (IFS=:; for dir in $PATH; do rm -vf $dir/$fucker; done) + done - beep -l 50 -f 2000; pkill wpa_supplicant + beep -l 50 -f 2000; pkill wpa + beep -l 50 -f 2000; rm -vf /var/run/wpa_supplicant/* beep -l 50 -f 2000; wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf & while ! wpa_cli status | grep -q wpa_state=COMPLETED; do beep -l 50 -f 2000 -D 50 -n -l 50 -f 2000 |