Format the script correctly, and fix ssids with spaces in hopefully once and for all
This commit is contained in:
parent
795408632b
commit
a825e6f30f
@ -27,7 +27,12 @@ _iwconfig_get() {
|
||||
}
|
||||
|
||||
_get_ssid() {
|
||||
_iwconfig_get 1
|
||||
local ssid="$(_iwconfig_get 1)"
|
||||
# If the ssid has a space then it's wrapped in quotes.
|
||||
# This is a problem if the real ssid has a quote at the start or the end :/
|
||||
ssid=${ssid#\"}
|
||||
ssid=${ssid%\"}
|
||||
echo "${ssid}"
|
||||
}
|
||||
|
||||
_get_ap_mac_address() {
|
||||
@ -40,11 +45,11 @@ _get_channel() {
|
||||
|
||||
iwconfig_report() {
|
||||
local m="connected to"
|
||||
local ssid=$(_get_ssid)
|
||||
local mac=$(_get_ap_mac_address "${iface}")
|
||||
local ssid="$(_get_ssid)"
|
||||
local mac="$(_get_ap_mac_address "${iface}")"
|
||||
[ -n "${mac}" ] && mac=" at ${mac}"
|
||||
local wep_status="$(iwconfig_get_wep_status "${iface}")"
|
||||
local channel=$(_get_channel)
|
||||
local channel="$(_get_channel)"
|
||||
[ -n "${channel}" ] && channel="on channel ${channel} "
|
||||
|
||||
eindent
|
||||
@ -97,9 +102,9 @@ iwconfig_setup_specific() {
|
||||
local key=$(iwconfig_get_wep_key)
|
||||
|
||||
# Now set the key
|
||||
eval ifconfig "${IFACE}" wepkey "${key}"
|
||||
ifconfig "${IFACE}" wepkey "${key}"
|
||||
|
||||
eval ifconfig "${IFACE}" ssid "${SSID}" || return 1
|
||||
ifconfig "${IFACE}" ssid "${SSID}" || return 1
|
||||
|
||||
eval channel=\$channel_${IFVAR}
|
||||
# We default the channel to 3
|
||||
@ -168,12 +173,12 @@ iwconfig_associate() {
|
||||
|
||||
ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}"
|
||||
|
||||
if ! eval ifconfig "${IFACE}" wepkey "${key}" ; then
|
||||
if ! ifconfig "${IFACE}" wepkey "${key}" ; then
|
||||
eerror "Invalid WEP key ${key}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
eval ifconfig "${IFACE}" ssid "${SSID}" || return 1
|
||||
ifconfig "${IFACE}" ssid "${SSID}" || return 1
|
||||
iwconfig_user_config
|
||||
|
||||
if [ "${SSID}" != "any" ] && type preassociate >/dev/null 2>/dev/null ; then
|
||||
@ -198,15 +203,13 @@ iwconfig_associate() {
|
||||
while true; do
|
||||
_has_carrier && break
|
||||
sleep 1
|
||||
|
||||
[ ${timeout} -eq 0 ] && continue
|
||||
i=$((${i} + 1))
|
||||
[ ${i} -ge ${timeout} ] && return 1
|
||||
[ ${i} -ge ${timeout} ] && { eend 1; return 1; }
|
||||
done
|
||||
|
||||
if ! _has_carrier ; then
|
||||
eend 1
|
||||
return 1
|
||||
fi
|
||||
_has_carrier || { eend 1; return 1; }
|
||||
eend 0
|
||||
|
||||
if [ "${SSID}" = "any" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user