# HG changeset patch # User Pascal Bellard # Date 1216765502 0 # Node ID 10d28491bea51396291488a0d282f853bab428b8 # Parent 7ed6dc4683addd37d62300facbd9ee19fe1ad152 Misc wifi fixes from sygne@ombres.eu diff -r 7ed6dc4683ad -r 10d28491bea5 etc/init.d/network.sh --- a/etc/init.d/network.sh Sat Jul 19 15:17:25 2008 +0000 +++ b/etc/init.d/network.sh Tue Jul 22 22:25:02 2008 +0000 @@ -5,6 +5,9 @@ . /etc/init.d/rc.functions . /etc/network.conf +# Only configure hostname and loopback at boot time +if [ -n "$1" ]; then + # Set hostname. echo -n "Setting hostname... " /bin/hostname -F /etc/hostname @@ -16,6 +19,8 @@ /sbin/route add 127.0.0.1 lo status +fi + # For wifi. Users just have to enable it throught yes and usually # essid any will work and interface is autodetected. if [ "$WIFI" = "yes" ] || grep -q "wifi" /proc/cmdline; then @@ -23,17 +28,20 @@ for i in $NDISWRAPPER_DRIVERS; do ndiswrapper -i $i done + echo -n "Loading ndiswrapper module..." modprobe ndiswrapper + status fi - if ! iwconfig $WIFI_INTERFACE 2>&1 | grep -iq "essid"; then + if [ ! -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then + echo "$WIFI_INTERFACE is not a wifi interface, changing it." WIFI_INTERFACE=$(grep : /proc/net/dev | cut -d: -f1 | \ while read dev; do iwconfig $dev 2>&1 | \ grep -iq "essid" && { echo $dev ; break; }; \ done) [ -n "$WIFI_INTERFACE" ] && sed -i "s/^WIFI_INTERFACE=.*/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/" /etc/network.conf fi - [ -n "$WPA_DRIVER" ] && WPA_DRIVER="wext" - if iwconfig $WIFI_INTERFACE 2>&1 | grep -iq "essid"; then + [ -n "$WPA_DRIVER" ] || WPA_DRIVER="wext" + if iwconfig $WIFI_INTERFACE 2>&1 | grep -iq "unassociated"; then IWCONFIG_ARGS="" [ -n "$WIFI_MODE" ] && IWCONFIG_ARGS="$IWCONFIG_ARGS mode $WIFI_MODE" [ -n "$WIFI_KEY" ] && case "$WIFI_KEY_TYPE" in @@ -49,7 +57,8 @@ priority=5 } EOF - wpa_supplicant -B -w -c/tmp/wpa.conf -D$DRIVER -i$WIFI_INTERFACE + echo -n "starting wpa_supplicant, for WPA-PSK" + wpa_supplicant -B -w -c/tmp/wpa.conf -D$WPA_DRIVER -i$WIFI_INTERFACE ;; any|ANY) cat > /tmp/wpa.conf <