5 |
# get default settings |
# get default settings |
6 |
source /etc/conf.d/network |
source /etc/conf.d/network |
7 |
|
|
8 |
|
wait_online() |
9 |
|
{ |
10 |
|
local timeout="1" |
11 |
|
local iface="$2" |
12 |
|
|
13 |
|
(( timeout *= 10 )) |
14 |
|
|
15 |
|
while [ ! -e /sys/class/net/${iface} ] |
16 |
|
do |
17 |
|
(( timeout-- > 0 )) || return 1 |
18 |
|
sleep 0.1 |
19 |
|
done |
20 |
|
|
21 |
|
return 0 |
22 |
|
} |
23 |
|
|
24 |
# read values from files |
# read values from files |
25 |
read_value() |
read_value() |
26 |
{ |
{ |
183 |
return 1 |
return 1 |
184 |
fi |
fi |
185 |
|
|
186 |
if [ ! -x /sbin/wpa_supplicant ] |
if [ ! -x $(type -P wpa_supplicant) ] |
187 |
then |
then |
188 |
echo "WPA: wpa_supplicant not installed. Aborting setup." |
echo "WPA: wpa_supplicant not installed. Aborting setup." |
189 |
return 1 |
return 1 |
193 |
[[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant |
[[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant |
194 |
|
|
195 |
# check the configuration |
# check the configuration |
196 |
[[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant.auto |
[[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant/wpa_supplicant.auto |
197 |
[[ -z ${WIRELESS_WPA_SKEL} ]] && WIRELESS_WPA_SKEL=/etc/conf.d/wpa_supplicant.skel |
[[ -z ${WIRELESS_WPA_SKEL} ]] && WIRELESS_WPA_SKEL=/etc/conf.d/wpa_supplicant.skel |
198 |
|
|
199 |
# use wext as default driver, do not abort here anymore |
# use wext as default driver, do not abort here anymore |
344 |
fi |
fi |
345 |
|
|
346 |
# first check for brctl |
# first check for brctl |
347 |
if [[ -z $(which brctl) ]] |
if [[ -z $(type -P brctl) ]] |
348 |
then |
then |
349 |
echo "brctl not found! Please install 'net-misc/bridge-utils'." |
echo "brctl not found! Please install 'net-misc/bridge-utils'." |
350 |
return 1 |
return 1 |
444 |
source /etc/conf.d/net.${iface} || exit 1 |
source /etc/conf.d/net.${iface} || exit 1 |
445 |
checkconfig |
checkconfig |
446 |
|
|
447 |
|
# wait until the device is created |
448 |
|
wait_online 5 "${iface}" || { echo "device '${iface}' does not exist"; continue; } |
449 |
|
|
450 |
# setup mac |
# setup mac |
451 |
if [[ -n ${FORCE_MAC_TO} ]] |
if [[ -n ${FORCE_MAC_TO} ]] |
452 |
then |
then |
460 |
fi |
fi |
461 |
|
|
462 |
# now configure wireless_extensions |
# now configure wireless_extensions |
463 |
[ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}" |
[ -x $(type -P iwconfig) ] && setup_wireless_extensions "${iface}" |
464 |
|
|
465 |
# activate the interface |
# activate the interface |
466 |
ifconfig "${iface}" up |
ifconfig "${iface}" up |