#!/bin/bash #wpa2ath0 echo "Type ath0 for DWL-G650" echo "Type wlan0 for IPW3945 (Not Working)" echo -ne "Enter card interface to use: " read -e iface if [[ $iface = $iface ]] ; then echo "Attempting to configure card with $iface " elif [[ $iface = ath0 ]] ; then ifconfig ath0 down; ifconfig ath0 up elif [[ $iface = wlan0 ]] ; then ifconfig wlan0 down; ifconfig wlan0 up else [[ $iface = "" ]] echo "No interface selected exiting..." exit fi if [[ $iface = "" ]]; then echo "No interface selected exiting..." exit elif [ 1 = 1 ] ; then echo " Attempting to connect... " #copying correct variant to location. cp /mnt/sdb1/wpa_supplicant.conf /etc/ #remove old dhcpcd leases to ensure fresh start. if [ -e "/etc/dhcpc/dhcpcd-$iface.cache" ] ; then rm /etc/dhcpc/dhcpcd-*; fi #Stop any wpa_supplicant that is running. if [ -e "/var/run/wpa_supplicant/$iface" ] ; then rm /var/run/wpa_supplicant/$iface fi wpa_supplicant -w -Dwext -i$iface -B -c/etc/wpa_supplicant.conf echo "DHCP Initialized on $iface" if [[ $iface = ath0 ]] ; then dhcpcd ath0 elif [[ $iface = wlan0 ]] ; then dhcpcd wlan0 fi echo " Connection established..." echo " Done... " sleep 1 fi exit