To make this work without having to reboot after the end of each connection do the following:
change to root
- Code: Select all
sudo -s
update ipkg
- Code: Select all
ipkg update
install dhcp-client
- Code: Select all
ipkg install dhcp-client
create a new script file
- Code: Select all
touch WPA_wifi.sh
make it executable
- Code: Select all
chmod 700 WPA_wifi.sh
open your favorite editor
- Code: Select all
vi WPA_wifi.sh
copy the following into the script
- Code: Select all
#!/bin/sh
if [ $1 == "start" ]
then
psk=`echo $3 | wpa_passphrase $2 |grep '\spsk='|cut -b 6-69`
rmmod rt3070sta
modprobe rt3070sta
ifconfig ra0 up
iwconfig ra0 essid $2
iwpriv ra0 set AuthMode=WPAPSK
iwpriv ra0 set EncrypType=TKIP
iwpriv ra0 set WPAPSK=$psk
dhclient ra0
elif [ $1 == "stop" ]
then
dhclient -r ra0
else
echo "USEAGE FOR WPA_WIFI.SH"
echo "#### To start your connection: ####"
echo "./wpa_wifi.sh start YOUR_AP_NAME YOUR_AP_PASSWORD"
echo "#### To stop your connection: ####"
echo "./wpa_wifi.sh stop"
fi
Now, If you are currently connected with my old script you must restart one last time.
Now in order to run the script make sure you are root if not already
- Code: Select all
sudo -s
To connect to a network type the following
- Code: Select all
./WPA_wifi start YOUR_AP_NAME YOUR_CLEARTXT_WPA_PASSWORD
To disconnect type the following
- Code: Select all
./WPA_wifi stop
Hope this helps. Ill try to get around to editing the operating systems network GUI for next time.
** EDITED ... I had a typo in the stop portion of this script***