Magellan Linux

Annotation of /trunk/linux-wlan-ng/wlan.rc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (hide annotations) (download)
Thu Sep 15 20:06:54 2005 UTC (19 years, 1 month ago) by niro
File size: 2491 byte(s)
new file

1 niro 35 #!/bin/bash
2     # $Header: /root/magellan-cvs/src/linux-wlan-ng/wlan.rc,v 1.1 2005-09-15 20:06:54 niro Exp $
3    
4     #%rlevels: 2:s 3:s 4:s 5:s 0:k 6:k
5     #%start: 9
6     #%stop: 91
7    
8     #deps
9     #%needs:
10     #%before:
11     #%after:
12    
13     source /etc/sysconfig/rc
14     source $rc_functions
15    
16     source_config() {
17     if [ -f /etc/wlan/shared ]
18     then
19     source /etc/wlan/shared
20     else
21     return 1
22     fi
23     return 0
24     }
25    
26     case "$1" in
27     start)
28     echo -e ${COLOREDSTAR}"Starting WLAN devices ..."
29    
30     if ! source_config
31     then
32     echo "Error loading /etc/wlan/shared"
33     print_status failure
34     return 1
35     fi
36    
37     # NOTE: We don't explicitly insmod the card driver here. The
38     # best thing to do is to specify an alias in /etc/modules.conf.
39     # Then, the first time we call wlanctl with the named device,
40     # the kernel module autoload stuff will take over.
41    
42     for DEVICE in $WLAN_DEVICES; do
43     #=======ENABLE========================================
44     # Do we want to init the card at all?
45     eval 'WLAN_ENABLE=$ENABLE_'$DEVICE
46     if ! is_true $WLAN_ENABLE ; then
47     continue
48     fi
49    
50     if is_true $WLAN_DOWNLOAD; then
51     wlan_download $DEVICE
52     fi
53    
54     wlan_enable $DEVICE
55    
56     #=======MAC STARTUP=========================================
57     wlan_supports_scan $DEVICE
58    
59     if [ $? = 0 ] ; then
60     wlan_scan $DEVICE
61     if [ $? = 0 ] ; then
62     wlan_source_config_for_ssid "$ssid:$bssid"
63    
64     wlan_user_mibs $DEVICE
65     # make it quiet
66     error=`eval wlan_wep $DEVICE`
67    
68     grep 'autojoin' /proc/net/p80211/$DEVICE/wlandev > /dev/null
69     if [ $? = 0 ]; then
70     wlan_infra $DEVICE
71     else
72     wlan_dot11_join $DEVICE
73     fi
74     else
75     echo "network not found. maybe start IBSS?"
76     fi
77     else
78     wlan_source_config $DEVICE
79    
80     wlan_user_mibs $DEVICE
81     # make it quiet
82     error=`eval wlan_wep $DEVICE`
83    
84     if is_true $IS_ADHOC ; then
85     wlan_adhoc $DEVICE
86     else
87     wlan_infra $DEVICE
88     fi
89     fi
90     done
91    
92     evaluate_retval
93     splash svc_started splash 0
94     ;;
95    
96     stop)
97     echo -e ${COLOREDSTAR}"Shutting Down WLAN Devices ..."
98     if ! source_config
99     then
100     echo "Error loading /etc/wlan/shared"
101     print_status failure
102     return 1
103     fi
104    
105     # Do a reset on each device to make sure none of them are still
106     # trying to generate interrupts.
107     for DEVICE in $WLAN_DEVICES; do
108     # This just makes it quiet...
109     error="$(eval wlan_disable $DEVICE)"
110     done
111    
112     evaluate_retval
113     splash svc_stopped splash 0
114     ;;
115    
116     restart)
117     $0 stop
118     sleep 1
119     $0 start
120     ;;
121    
122     *)
123     echo "Usage: $0 {start|stop|restart}"
124     exit 1
125     ;;
126     esac