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 |
|
echo "waiting 0.1 seconds for device '${iface}' - timeout->'${timeout}'" |
19 |
|
sleep 0.1 |
20 |
|
done |
21 |
|
|
22 |
|
return 0 |
23 |
|
} |
24 |
|
|
25 |
# read values from files |
# read values from files |
26 |
read_value() |
read_value() |
27 |
{ |
{ |
184 |
return 1 |
return 1 |
185 |
fi |
fi |
186 |
|
|
187 |
if [ ! -x /sbin/wpa_supplicant ] |
if [ ! -x $(type -P wpa_supplicant) ] |
188 |
then |
then |
189 |
echo "WPA: wpa_supplicant not installed. Aborting setup." |
echo "WPA: wpa_supplicant not installed. Aborting setup." |
190 |
return 1 |
return 1 |
194 |
[[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant |
[[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant |
195 |
|
|
196 |
# check the configuration |
# check the configuration |
197 |
[[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant.auto |
[[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant/wpa_supplicant.auto |
198 |
[[ -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 |
199 |
|
|
200 |
# use wext as default driver, do not abort here anymore |
# use wext as default driver, do not abort here anymore |
345 |
fi |
fi |
346 |
|
|
347 |
# first check for brctl |
# first check for brctl |
348 |
if [[ -z $(which brctl) ]] |
if [[ -z $(type -P brctl) ]] |
349 |
then |
then |
350 |
echo "brctl not found! Please install 'net-misc/bridge-utils'." |
echo "brctl not found! Please install 'net-misc/bridge-utils'." |
351 |
return 1 |
return 1 |
445 |
source /etc/conf.d/net.${iface} || exit 1 |
source /etc/conf.d/net.${iface} || exit 1 |
446 |
checkconfig |
checkconfig |
447 |
|
|
448 |
|
# wait until the device is created |
449 |
|
wait_online 5 "${iface}" || { echo "device '${iface}' does not exist"; continue; } |
450 |
|
|
451 |
# setup mac |
# setup mac |
452 |
if [[ -n ${FORCE_MAC_TO} ]] |
if [[ -n ${FORCE_MAC_TO} ]] |
453 |
then |
then |
461 |
fi |
fi |
462 |
|
|
463 |
# now configure wireless_extensions |
# now configure wireless_extensions |
464 |
[ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}" |
[ -x $(type -P iwconfig) ] && setup_wireless_extensions "${iface}" |
465 |
|
|
466 |
# activate the interface |
# activate the interface |
467 |
ifconfig "${iface}" up |
ifconfig "${iface}" up |