| 1 |
# Copyright (c) 2004-2006 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# Contributed by Roy Marples (uberlord@gentoo.org)
|
| 4 |
# Many thanks to all the people in the Gentoo forums for their ideas and
|
| 5 |
# motivation for me to make this and keep on improving it
|
| 6 |
|
| 7 |
# Load our config if it exists
|
| 8 |
[[ -f "$(add_suffix "/etc/conf.d/wireless" )" ]] \
|
| 9 |
&& source "$(add_suffix "/etc/conf.d/wireless" )"
|
| 10 |
|
| 11 |
# void essidnet_depend(void)
|
| 12 |
#
|
| 13 |
# Sets up the dependancies for the module
|
| 14 |
essidnet_depend() {
|
| 15 |
before interface system
|
| 16 |
after wireless
|
| 17 |
installed wireless
|
| 18 |
functions wireless_exists wireless_get_essid wireless_get_ap_mac_address
|
| 19 |
}
|
| 20 |
|
| 21 |
# bool essidnet_start(char *iface)
|
| 22 |
#
|
| 23 |
# All interfaces and module scripts can depend on the variables function
|
| 24 |
# which returns a space seperated list of user configuration variables
|
| 25 |
# We can override each variable here from a given ESSID or the MAC
|
| 26 |
# of the AP connected to. MAC configuration takes precedence
|
| 27 |
# Always returns 0
|
| 28 |
essidnet_pre_start() {
|
| 29 |
local iface="$1"
|
| 30 |
|
| 31 |
wireless_exists "${iface}" || return 0
|
| 32 |
|
| 33 |
local mac=$(wireless_get_ap_mac_address "${iface}")
|
| 34 |
local ESSID=$(wireless_get_essid "${iface}")
|
| 35 |
local essid=$(bash_variable "${ESSID}")
|
| 36 |
mac="${mac//:/}"
|
| 37 |
|
| 38 |
vebegin "Configuring ${iface} for ESSID \"${ESSID//\\\\/\\\\}\"" 2>/dev/null
|
| 39 |
configure_variables "${iface}" "${essid}" "${mac}"
|
| 40 |
|
| 41 |
# Backwards compat for old gateway var
|
| 42 |
x="gateway_${essid}"
|
| 43 |
[[ -n ${!x} ]] && gateway="${iface}/${!x}"
|
| 44 |
|
| 45 |
veend 0 2>/dev/null
|
| 46 |
return 0
|
| 47 |
}
|
| 48 |
|
| 49 |
# vim: set ts=4 :
|