#!/bin/bash #Wireless # chmod 755 Wireless echo "Type ath0 for DWL-G650" echo "Type wlan0 for IPW3945 (Not Working)" echo -ne "Enter card interface to use: " read -e iface echo -n "Attempting to configure card with $iface " case "$iface" in ath0) ifconfig ath0 down; ifconfig ath0 up; ;; wlan0) ifconfig wlan0 down; ifconfig wlan0 up; ;; *) echo "Incorrect interface selected exiting..."; ;; esac if [ $iface = "" ]; then echo "No interface selected exiting..." exit elif [ 1 = 1 ] ; then echo " Attempting to connect... " #copying correct variant to location. (Edit location to suite your needs or comment out) 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