#!/bin/sh # lighthotplug - Karthik Arumugham - evolinux@karthik.com # http://www.psychosis.net/evo-linux/ # version 1.1 - Oct 17, 2002 # This is a simple hotplug script that I made for my Compaq USB Wireless card. # This is messy, and very specific to my own needs. if [ "$1" = "usb" ] && [ "$ACTION" = "add" ] && \ [ "$PRODUCT" = "1668/421/132" ]; then pump -k /usr/local/sbin/wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable # Joining with ssid= seems to be very important. If you specify an ssid, # the card doesn't want to associate with anything. I don't know how well # this works with networks that don't support broadcast ssid. /usr/local/sbin/wlanctl-ng wlan0 lnxreq_autojoin ssid= authtype=opensystem # Wait until the drivers are loaded. ap=`iwconfig wlan0 2> /dev/null | grep Access | sed 's/^.*Point: //' | cut -d ' ' -f 1` aptry=1 while [ "$ap" = "" ]; do if [ "$aptry" -gt 5 ]; then exit 1 fi sleep 1 ap=`iwconfig wlan0 2> /dev/null | grep Access | sed 's/^.*Point: //' | cut -d ' ' -f 1` aptry=`expr $aptry + 1` done # Wait until the card is associated with something. ap=`iwconfig wlan0 2> /dev/null | grep Access | sed 's/^.*Point: //' | cut -d ' ' -f 1` aptry=1 while [ "$ap" = "00:00:00:00:00:00" ]; do if [ "$aptry" -gt 10 ]; then exit 1 fi sleep 1 ap=`iwconfig wlan0 2> /dev/null | grep Access | sed 's/^.*Point: //' | cut -d ' ' -f 1` aptry=`expr $aptry + 1` done # This is some code I added in to hardcore an IP address when I used a # certain access point. It's commented out for now; pump will always run. # You'll need to remove the -d flag from pump if you want it to set your # dns server for you. # if [ "$ap" = "42:13:37:42:13:37" ]; then # ifconfig wlan0 199.232.20.42 netmask 255.255.255.0 # route add default gw 199.232.20.1 # ifconfig wlan0 mtu 1442 # else pump -d -i wlan0 # fi fi exit 0