#!/bin/bash # $Header: /root/magellan-cvs/src/linux-wlan-ng/wlan.rc,v 1.1 2005-09-15 20:06:54 niro Exp $ #%rlevels: 2:s 3:s 4:s 5:s 0:k 6:k #%start: 9 #%stop: 91 #deps #%needs: #%before: #%after: source /etc/sysconfig/rc source $rc_functions source_config() { if [ -f /etc/wlan/shared ] then source /etc/wlan/shared else return 1 fi return 0 } case "$1" in start) echo -e ${COLOREDSTAR}"Starting WLAN devices ..." if ! source_config then echo "Error loading /etc/wlan/shared" print_status failure return 1 fi # NOTE: We don't explicitly insmod the card driver here. The # best thing to do is to specify an alias in /etc/modules.conf. # Then, the first time we call wlanctl with the named device, # the kernel module autoload stuff will take over. for DEVICE in $WLAN_DEVICES; do #=======ENABLE======================================== # Do we want to init the card at all? eval 'WLAN_ENABLE=$ENABLE_'$DEVICE if ! is_true $WLAN_ENABLE ; then continue fi if is_true $WLAN_DOWNLOAD; then wlan_download $DEVICE fi wlan_enable $DEVICE #=======MAC STARTUP========================================= wlan_supports_scan $DEVICE if [ $? = 0 ] ; then wlan_scan $DEVICE if [ $? = 0 ] ; then wlan_source_config_for_ssid "$ssid:$bssid" wlan_user_mibs $DEVICE # make it quiet error=`eval wlan_wep $DEVICE` grep 'autojoin' /proc/net/p80211/$DEVICE/wlandev > /dev/null if [ $? = 0 ]; then wlan_infra $DEVICE else wlan_dot11_join $DEVICE fi else echo "network not found. maybe start IBSS?" fi else wlan_source_config $DEVICE wlan_user_mibs $DEVICE # make it quiet error=`eval wlan_wep $DEVICE` if is_true $IS_ADHOC ; then wlan_adhoc $DEVICE else wlan_infra $DEVICE fi fi done evaluate_retval splash svc_started splash 0 ;; stop) echo -e ${COLOREDSTAR}"Shutting Down WLAN Devices ..." if ! source_config then echo "Error loading /etc/wlan/shared" print_status failure return 1 fi # Do a reset on each device to make sure none of them are still # trying to generate interrupts. for DEVICE in $WLAN_DEVICES; do # This just makes it quiet... error="$(eval wlan_disable $DEVICE)" done evaluate_retval splash svc_stopped splash 0 ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac