]> git.donarmstrong.com Git - bin.git/blobdiff - cycle_wireless
Abstract out GIT_HOST
[bin.git] / cycle_wireless
index 90b940e0d64014c17eaddca9638dbc1bd181e453..dc949cca4e8dd06ecf0c9dff23f9cc10b6897f80 100755 (executable)
@@ -1,15 +1,6 @@
 #!/bin/sh
 
-NETWORK="$1"
-WIRELESS="$2"
-
-if [ -z "$NETWORK" ]; then
-       NETWORK="homewlan";
-fi;
-
-if [ -z "$WIRELESS" ]; then
-       WIRELESS="wireless";
-fi;
+WIRELESS="$1"
 
 # First try a minor cycle
 
@@ -25,8 +16,14 @@ fi;
 
 # Failure, so major cycle
 sudo ifdown wireless;
-if [ "$WIRELESS" == "wireless" ]; then 
-    sudo modprobe -r bcm43xx;
-    sudo modprobe bcm43xx;
+if [ "$WIRELESS" == "wireless" ]; then
+    if lsmod|grep -q bcm43xx; then
+       sudo modprobe -r bcm43xx;
+       sudo modprobe bcm43xx;
+    else
+       sudo modprobe -r b43;
+       sudo modprobe b43;
+    fi;
+    sleep 2s;
 fi;
-sudo ifup "wireless=${NETWORK}";
+sudo ifup "wireless";