5 |
# get default settings |
# get default settings |
6 |
source /etc/conf.d/network |
source /etc/conf.d/network |
7 |
|
|
8 |
|
iface_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 |
{ |
{ |
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 |
|
iface_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 |