Talk:Wireless autodetection
From ArchWiki
I have made some modifications to this script to better suit roaming in networks with multiple APs and same ESSID. I'll post my version here, perhaps it will be of use for someone.
Quick explanation of changes: aKNOWNNETS is read straight from filenames in network-profiles, no need to edit multiple files when adding new networks. Changed netdetect to identify networks by ESSID instead of MAC.
To /etc/rc.conf:
aKNOWNNETS=`ls /etc/network-profiles` NET_PROFILES=(detect)
To /usb/bin/netdetect
- !/bin/bash
. /etc/rc.conf
aSCANNEDNETS=(`ifconfig wlan0 up; iwlist wlan0 scanning | grep ESSID | tr \" \ | awk '{print $2}'`)
for J in ${aSCANNEDNETS[*]} ; do
for K in ${aKNOWNNETS[*]} ; do
if [ $J == $K ]
then
DET_ESSID=$K
break
fi
done
if [ $DET_ESSID ]
then
break
fi
done
if [ $DET_ESSID ]
then
netcfg $DET_ESSID
else
echo "could not detect a known AP..."
netcfg -c lan-dhcp
fi