aboutsummaryrefslogtreecommitdiff
path: root/netcfg
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-06-15 21:54:12 +0000
committerJudd Vinet <judd@archlinux.org>2006-06-15 21:54:12 +0000
commit6cc15eeb857f9a01e7199c4c665866c7728244aa (patch)
tree9d3e0981e1a22b11115a829d4e4ce17600f1499b /netcfg
parent96971f91453600f1d94d3e333dfb8773d1e4f596 (diff)
downloadinitscripts-6cc15eeb857f9a01e7199c4c665866c7728244aa.tar.xz
added patch from James Rayner to auto-configure WPA through netcfg
Diffstat (limited to 'netcfg')
-rwxr-xr-xnetcfg18
1 files changed, 16 insertions, 2 deletions
diff --git a/netcfg b/netcfg
index 2971084..d070dc2 100755
--- a/netcfg
+++ b/netcfg
@@ -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