#!/bin/sh # Source function library. . /etc/init.d/functions DEFAULT_LOCATION="Work" stop() { # check to see if the ath0 driver is loaded; if it is, # admin interface administratively down. /bin/cat /proc/net/dev | /bin/grep -q ath0 if [ $? -eq 0 ]; then /sbin/ifconfig ath0 down fi # check to see if the modules are loaded - if they are, # remove them. /bin/cat /proc/modules | /bin/grep -q ath_pci if [ $? -eq 0 ]; then /sbin/rmmod ath_pci /sbin/rmmod ath_hal /sbin/rmmod wlan fi # enable the built-in networking /etc/sysconfig/network-scripts/ifup eth0 } start() { if [ $# -gt 0 ]; then WHERE=$1 else WHERE=${DEFAULT_LOCATION} fi set noglob # check for the card's presence. Alter or eliminate this test # to match your hardware. /bin/cat /proc/pci | grep -q "168c:0012" if [ $? -ne 0 ]; then # eval `/sbin/cardctl info 0` # if [ "$MANFID" != "0271,0012" ]; then # eval `/sbin/cardctl info 1` # if [ "$MANFID" != "0271,0012" ]; then echo "Netgear WAB501 802.11a/b Wireless Adapter card not found." exit 1 # fi fi # disable the built-in networking /etc/sysconfig/network-scripts/ifdown eth0 # get the configuration for this card. eval `/bin/cat /etc/sysconfig/network-scripts/ifcfg-ath0-${WHERE}` # add the modules; if the modules are already added there is no problem. /sbin/modprobe wlan /sbin/modprobe ath_hal /sbin/modprobe ath_pci # start with the interface administratively down. /sbin/ifconfig ath0 down # administrate the interface /sbin/iwconfig ath0 essid "${SSID}" /sbin/iwconfig ath0 mode Managed /sbin/iwconfig ath0 key $WEPKEY /sbin/iwpriv ath0 mode ${WIRELESS_CARD_MODE} # set 802.11a mode. /sbin/iwpriv ath0 turbo ${WIRELESS_TURBO_MODE} # set turbo mode /sbin/iwconfig ath0 rate ${WIRELESS_RATE} # set card rate # configure the interface up /sbin/ifconfig ath0 ${IPADDR} netmask ${NETMASK} up /sbin/route add default gw ${GATEWAY} } # See how we were called. case "$1" in start) shift start $* ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|reload}" exit 1 esac exit $RETVAL