diff options
author | Judd Vinet <judd@archlinux.org> | 2006-06-15 21:54:12 +0000 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2006-06-15 21:54:12 +0000 |
commit | 6cc15eeb857f9a01e7199c4c665866c7728244aa (patch) | |
tree | 9d3e0981e1a22b11115a829d4e4ce17600f1499b | |
parent | 96971f91453600f1d94d3e333dfb8773d1e4f596 (diff) |
added patch from James Rayner to auto-configure WPA through netcfg
-rwxr-xr-x | netcfg | 18 | ||||
-rw-r--r-- | profile-template | 3 |
2 files changed, 18 insertions, 3 deletions
@@ -107,6 +107,7 @@ start_profile() # Configure wireless settings, if necessary [ "$WIFI_INTERFACE" ] || WIFI_INTERFACE=$INTERFACE + if [ "$IWOPTS" ]; then iwconfig $WIFI_INTERFACE $IWOPTS [ $? -ne 0 ] && stat_fail && return @@ -116,8 +117,21 @@ start_profile() # Start wpa_supplicant, if necessary if [ "$USEWPA" = "yes" -o "$USEWPA" = "YES" ]; then ifconfig $WIFI_INTERFACE up - wpa_supplicant -wB -i $WIFI_INTERFACE -c /etc/wpa_supplicant.conf $WPAOPTS - # I donīt know how we could determine if wpa_supplicant is ready... + + WPA_CONF="/etc/wpa_supplicant.conf" + if [ "$AUTOWPA" = "yes" -o "$AUTOWPA" = "YES" ]; then + WPA_CONF=`mktemp /tmp/wpa.XXXXXXXX` + # file will contain PSK, limit reading + chmod 600 $WPA_CONF + echo "ctrl_interface=/var/run/wpa_supplicant" > $WPA_CONF + wpa_passphrase $ESSID "$PASSKEY" >> $WPA_CONF + [ $? -ne 0 ] && cat $WPA_CONF && stat_fail && return + fi + + [ "$WPA_OPTS" ] || WPA_OPTS="-Dwext" + wpa_supplicant -wB -i ${WIFI_INTERFACE} -c ${WPA_CONF} $WPA_OPTS + + # I donīt know how we could determine if wpa_supplicant is ready sleep 2 let i=0 while ! wpa_cli status | grep "wpa_state=COMPLETED" >/dev/null 2>&1; do diff --git a/profile-template b/profile-template index b30937f..868a389 100644 --- a/profile-template +++ b/profile-template @@ -27,9 +27,10 @@ DNS2= #WIFI_WAIT=5 # seconds to wait for the wireless card to # associate before bringing the interface up - #USEWPA="yes" # start wpa_supplicant with the profile #WPAOPTS="" # use "" for normal operation or specify additional # options (eg, "-D ipw") # see /etc/wpa_supplicant.conf for configuration +#AUTOWPA="yes" # automatically configure WPA +#PASSKEY="" # wpa passkey/phrase. for use with AUTOWPA |