aboutsummaryrefslogtreecommitdiff
path: root/netcfg
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2005-10-22 21:23:47 +0000
committerJudd Vinet <judd@archlinux.org>2005-10-22 21:23:47 +0000
commitc8a4f09b7943a7fe9a875d9fc7af7decd29db6a2 (patch)
treef6ba9c4ff09ad2b75e975fb20cf92909740aeb37 /netcfg
parentf22d7a53b09ad0e28911117412c1cd0ab5c7bb68 (diff)
downloadinitscripts-c8a4f09b7943a7fe9a875d9fc7af7decd29db6a2.tar.xz
added patch for wpa_supplicant support
Diffstat (limited to 'netcfg')
-rwxr-xr-xnetcfg30
1 files changed, 27 insertions, 3 deletions
diff --git a/netcfg b/netcfg
index bfc2532..4ede296 100755
--- a/netcfg
+++ b/netcfg
@@ -40,7 +40,7 @@ stop_profile()
INTERFACE=$1
[ -f $STATE_DIR/$INTERFACE ] || return
- unset GATEWAY
+ unset GATEWAY IFOPTS
. $STATE_DIR/$INTERFACE
stat_busy "Shutting down interface: $INTERFACE"
@@ -48,7 +48,13 @@ stop_profile()
# bring down the default route (gateway)
[ "$GATEWAY" ] && route del default gw $GATEWAY
- # bring down the interface
+ # shutdown wpa_supplicant if it's running
+ [ "$WPAOPTS" ] && wpa_cli terminate >/dev/null 2>&1
+
+ # bring down dhcpcd if we're using it
+ [ "$IFOPTS" = "dhcp" -o "$IFOPTS" = "DHCP" ] && dhcpcd -k
+
+ # bring down the interface itself
ifconfig $INTERFACE down
rm -f $STATE_DIR/$INTERFACE
@@ -88,7 +94,7 @@ start_profile()
stat_busy "Starting network profile: $1"
# Re-read the profile (stop_profile might have overwritten our settings)
- unset DESCRIPTION INTERFACE IFOPTS IWOPTS WIFI_INTERFACE WIFI_WAIT
+ unset DESCRIPTION INTERFACE IFOPTS IWOPTS WIFI_INTERFACE WIFI_WAIT WPAOPTS
unset GATEWAY HOSTNAME DOMAIN DNS1 DNS2
. $PROFILE_DIR/$1
@@ -100,6 +106,24 @@ start_profile()
[ "$WIFI_WAIT" ] && sleep $WIFI_WAIT
fi
+ # Start wpa_supplicant, if necessary
+ if [ "$WPAOPTS" ]; 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...
+ sleep 2
+ let i=0
+ while ! /usr/bin/wpa_cli status | grep "wpa_state=COMPLETED" >/dev/null 2>&1; do
+ if [ $i -gt 10 ]; then
+ wpa_cli terminate >/dev/null 2>&1
+ ifconfig $WIFI_INTERFACE down
+ stat_fail && return
+ fi
+ sleep 2
+ let i++
+ done
+ fi
+
if [ "$IFOPTS" = "dhcp" -o "$IFOPTS" = "DHCP" ]; then
# remove the .pid file if it exists
rm -f /etc/dhcpc/dhcpcd-${INTERFACE}.{pid,cache} >/dev/null 2>&1