#!/bin/bash # author : Petr Simandl www.simandl.cz # date : 26/09/2007 version 0.0.0 # license : GPL # desc. : automatic setting atheros card for madwifi-ng driver #mac is enough to identify the card #mac="00:0E:8E:02:83:33" mac="00:0E:8E:02:83:33" iface="ath0" channel="1" rate="5.5M" ip="10.33.7.32 netmask 255.255.255.192 broadcast 10.33.7.63" essid="CZFree.Net.orgj.sz" mode="sta" distance="6000" band=2 ##################################################### #getting mask for ifaces recognition macgr=`echo $mac | tr ":" "." | sed 's/^00/0./'` #getting all actual ifaces by the mask and destroying them for i in `/sbin/ifconfig -a | grep $macgr | grep -v wifi | awk '{print $1}'` do /usr/local/bin/wlanconfig $i destroy done #getting iwace name iwace=`/sbin/ifconfig -a | grep $macgr | grep "^wifi" | awk '{print $1}'` ##################################################### /usr/local/bin/wlanconfig $iface create wlandev $iwace wlanmode $mode > /dev/null /sbin/ifconfig $iface inet $ip /sbin/iwconfig $iface essid "$essid" /sbin/iwpriv $iface mode $band /sbin/iwconfig $iface rate $rate /sbin/iwconfig $iface channel $channel sleep 1s /usr/local/bin/athctrl -i $iwace -d $distance sleep 10s /sbin/iwconfig $iface channel $channel