summaryrefslogtreecommitdiffstats
path: root/src/8021x
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2009-08-10 08:09:16 +0200
committerJames Rayner <james@archlinux.org>2009-08-10 08:09:16 +0200
commit9a3078d8cec470b3820c5597d5c8819d642e558d (patch)
tree7287f79ad908eb8cd6352b19c3e59e6bc57e4c94 /src/8021x
parent280b25e1171a4609356e888066614a4dc2ecb678 (diff)
downloadnetctl-9a3078d8cec470b3820c5597d5c8819d642e558d.tar.gz
netctl-9a3078d8cec470b3820c5597d5c8819d642e558d.tar.xz
revert pryor patch
Diffstat (limited to 'src/8021x')
-rw-r--r--src/8021x36
1 files changed, 14 insertions, 22 deletions
diff --git a/src/8021x b/src/8021x
index 7daecce..75030e9 100644
--- a/src/8021x
+++ b/src/8021x
@@ -1,53 +1,45 @@
-##################################
-##
-# /usr/lib/network/8021x
-##
-##################################
-
# Uses wpa_supplicant to check for association to a network
# wpa_check interface [timeout]
wpa_check()
{
- local INTERFACE="$1" TIMEOUT="${2:-15}" timeout=0
+ local timeout=0 INTERFACE=$1 TIMEOUT=${2:-15}
- while [[ "$timeout" -lt "$TIMEOUT" ]]; do
+ while [[ $timeout -lt $TIMEOUT ]]; do
( # Sometimes wpa_supplicant isn't ready so silence errors for 2s only to avoid hiding real errors
- if [[ "$timeout" -lt 2 ]]; then
- eval $(wpa_cli -i "$INTERFACE" status 2> /dev/null | fgrep "wpa_state=")
+ if [[ $timeout -lt 2 ]]; then
+ eval `wpa_cli status 2> /dev/null|grep wpa_state`
else
- eval $(wpa_cli -i "$INTERFACE" status | fgrep "wpa_state=")
+ eval `wpa_cli status|grep wpa_state`
fi
- [[ "$wpa_state" = COMPLETED ]]
+ [[ "$wpa_state" = "COMPLETED" ]]
) && return 0
sleep 1
let timeout++
done
wpa_cli terminate >/dev/null 2>&1
- report_fail "Couldn't associate/authenticate with wireless network."
+ err_append "Authentication/association failed"
return 1
}
start_wpa()
{
- local INTERFACE="$1" WPA_CONF="$2" WPA_OPTS="$3"
+ INTERFACE="$1"; WPA_CONF="$2"; WPA_OPTS="$3"
- wpa_supplicant -B -P "/var/run/wpa_supplicant_$INTERFACE.pid" -i "$INTERFACE" -c "$WPA_CONF" $WPA_OPTS
+ wpa_supplicant -B -P/var/run/wpa_supplicant_${INTERFACE}.pid -i"${INTERFACE}" -c "$WPA_CONF" $WPA_OPTS
sleep 1
- if [[ ! -f "/var/run/wpa_supplicant_$INTERFACE.pid" ]]; then
- report_fail "wpa_supplicant did not start, possible configuration error"
+ if [[ ! -f "/var/run/wpa_supplicant_${INTERFACE}.pid" ]]; then
+ err_append "wpa_supplicant did not start, possible configuration error"
return 1
fi
}
stop_wpa()
{
- wpa_cli -i "$1" terminate &> /dev/null
- sleep 1 # JP: need this else the file tends to disappear after [[ -f ... ]] but before cat...
- # see <http://bbs.archlinux.org/viewtopic.php?pid=515667#p515667>
- if [[ -f "/var/run/wpa_supplicant_$1.pid" ]]; then
- kill $(cat "/var/run/wpa_supplicant_$1.pid") &>/dev/null &
+ wpa_cli terminate &> /dev/null
+ if [[ -f /var/run/wpa_supplicant_$1.pid ]]; then
+ kill $(cat /var/run/wpa_supplicant_$1.pid) &>/dev/null &
fi
}