Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .

UserDocs/Distro/RedHat: rh-wireless

File rh-wireless, 2.1 kB (added by matt, 13 years ago)

RedHat? Init script.

Line 
1 #!/bin/sh
2
3 # Source function library.
4 . /etc/init.d/functions
5
6 DEFAULT_LOCATION="Work"
7
8 stop()
9 {
10         # check to see if the ath0 driver is loaded; if it is,
11         # admin interface administratively down.
12         /bin/cat /proc/net/dev | /bin/grep -q ath0
13         if [ $? -eq 0 ]; then
14                 /sbin/ifconfig ath0 down
15         fi
16
17         # check to see if the modules are loaded - if they are,
18         # remove them.
19         /bin/cat /proc/modules | /bin/grep -q ath_pci
20         if [ $? -eq 0 ]; then
21                 /sbin/rmmod ath_pci
22                 /sbin/rmmod ath_hal
23                 /sbin/rmmod wlan
24         fi
25
26         # enable the built-in networking
27         /etc/sysconfig/network-scripts/ifup eth0
28 }
29
30 start()
31 {
32         if [ $# -gt 0 ]; then
33                 WHERE=$1
34         else
35                 WHERE=${DEFAULT_LOCATION}
36         fi
37
38         set noglob
39
40         # check for the card's presence.  Alter or eliminate this test
41         # to match your hardware.
42         /bin/cat /proc/pci | grep -q "168c:0012"
43         if [ $? -ne 0 ]; then
44 #       eval `/sbin/cardctl info 0`
45 #       if [ "$MANFID" != "0271,0012" ]; then
46 #         eval `/sbin/cardctl info 1`
47 #         if [ "$MANFID" != "0271,0012" ]; then
48             echo "Netgear WAB501 802.11a/b Wireless Adapter card not found."
49             exit 1
50 #         fi
51         fi
52
53         # disable the built-in networking
54         /etc/sysconfig/network-scripts/ifdown eth0
55
56         # get the configuration for this card.
57         eval `/bin/cat /etc/sysconfig/network-scripts/ifcfg-ath0-${WHERE}`
58
59         # add the modules; if the modules are already added there is no problem.
60         /sbin/modprobe wlan
61         /sbin/modprobe ath_hal
62         /sbin/modprobe ath_pci
63
64         # start with the interface administratively down.
65         /sbin/ifconfig ath0 down
66
67         # administrate the interface
68         /sbin/iwconfig ath0 essid "${SSID}"
69         /sbin/iwconfig ath0 mode Managed
70         /sbin/iwconfig ath0 key $WEPKEY
71         /sbin/iwpriv ath0 mode ${WIRELESS_CARD_MODE}    # set 802.11a mode.
72         /sbin/iwpriv ath0 turbo ${WIRELESS_TURBO_MODE}  # set turbo mode
73         /sbin/iwconfig ath0 rate ${WIRELESS_RATE}       # set card rate
74
75         # configure the interface up
76         /sbin/ifconfig ath0 ${IPADDR} netmask ${NETMASK} up
77         /sbin/route add default gw ${GATEWAY}
78 }
79
80 # See how we were called.
81 case "$1" in
82   start)
83         shift
84         start $*
85         ;;
86   stop)
87         stop
88         ;;
89   restart|reload)
90         stop
91         start
92         RETVAL=$?
93         ;;
94   *)
95         echo $"Usage: $0 {start|stop|restart|reload}"
96         exit 1
97 esac
98
99 exit $RETVAL
100