I am using WPA, with my own wpa_supplicant.conf file.
The file looks like this:
# reading passphrase from stdin
network={
proto=RSN
scan_ssid=1
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
ssid="MyWifiName"
psk="a_very_secret_password"
}
Then I use this script to connect:
# ------------------begin script-----------------
echo ----------------------------------- >> /tmp/_wifi.log
date >> /tmp/_wifi.log
echo ----------------------------------- >> /tmp/_wifi.log
ifconfig wlan0 up >> /tmp/_wifi.log
for i in $(seq 1 5)
do
sleep 1
echo try $i >> /tmp/_wifi.log
iwlist wlan0 scanning >/dev/null
if [[ $? -eq 0 ]]
then
echo succeeded >> /tmp/_wifi.log
break
fi
echo unsuccesfull >> /tmp/_wifi.log
done
wpa_supplicant -B -Dwext -i wlan0 -c /opt/wpa_supplicant.conf >> /tmp/_wifi.log
/sbin/udhcpc -b -i wlan0 -x hostname:cherry >> /tmp/_wifi.log
# ------------------eind script-----------------
I wanted to use the wifi.tcz script, but that does not use the -b option in the udhcpc command. The -b option waits until it obtains a lease, and does not quit. My modem is slow or something, because without the -b it doesn't always work.