1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/network,v 1.16 2007-12-17 14:30:25 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/network,v 1.19 2008-12-22 22:01:15 niro Exp $ |
3 |
|
|
4 |
#%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k |
#%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k |
5 |
#%start: 20 |
#%start: 20 |
10 |
#%before: |
#%before: |
11 |
#%after: |
#%after: |
12 |
|
|
13 |
source /etc/sysconfig/rc |
source /etc/conf.d/rc |
14 |
source ${rc_functions} |
source ${rc_functions} |
15 |
|
|
16 |
# read values from files |
# read values from files |
24 |
# global |
# global |
25 |
local ONBOOT |
local ONBOOT |
26 |
local NETWORKING |
local NETWORKING |
27 |
|
|
28 |
# static |
# static |
29 |
local IP |
local IP |
30 |
local NETMASK |
local NETMASK |
195 |
# write default cfg from skeleton |
# write default cfg from skeleton |
196 |
cat ${WIRELESS_WPA_SKEL} > ${WIRELESS_WPA_CONFIG} |
cat ${WIRELESS_WPA_SKEL} > ${WIRELESS_WPA_CONFIG} |
197 |
|
|
198 |
|
local wpa_proto |
199 |
|
case ${WIRELESS_AUTH_MODE} in |
200 |
|
wpa) wpa_proto="WPA" ;; |
201 |
|
wpa2) wpa_proto="WPA2" ;; |
202 |
|
esac |
203 |
|
|
204 |
# setup the network entry |
# setup the network entry |
205 |
sed -i -e "s:@WIRELESS_ESSID@:${WIRELESS_ESSID}:g" \ |
sed -i -e "s:@WIRELESS_ESSID@:${WIRELESS_ESSID}:g" \ |
206 |
-e "s:@WIRELESS_KEY@:${WIRELESS_KEY}:g" \ |
-e "s:@WIRELESS_KEY@:${WIRELESS_KEY_ASCII}:g" \ |
207 |
|
-e "s:@WIRELESS_AUTH_MODE@:${wpa_proto}:g" \ |
208 |
${WIRELESS_WPA_CONFIG} |
${WIRELESS_WPA_CONFIG} |
209 |
fi |
fi |
210 |
|
|
252 |
[[ -n ${WIRELESS_NICK} ]] && iwconfig "${iface}" nick "${WIRELESS_NICK}" |
[[ -n ${WIRELESS_NICK} ]] && iwconfig "${iface}" nick "${WIRELESS_NICK}" |
253 |
|
|
254 |
case "${WIRELESS_AUTH_MODE}" in |
case "${WIRELESS_AUTH_MODE}" in |
255 |
wpa) config_wireless_wpa "${iface}" ;; |
wpa|wpa2) config_wireless_wpa "${iface}" ;; |
256 |
wep|on) config_wireless_wep "${iface}" ;; |
wep|on) config_wireless_wep "${iface}" ;; |
257 |
off) iwconfig "${iface}" enc off ;; |
off) iwconfig "${iface}" enc off ;; |
258 |
esac |
esac |
259 |
} |
} |
260 |
|
|
397 |
config_bridge_devices ${iface} add |
config_bridge_devices ${iface} add |
398 |
fi |
fi |
399 |
|
|
|
# activate the interface |
|
|
ifconfig "${iface}" up |
|
|
|
|
400 |
# now configure wireless_extensions |
# now configure wireless_extensions |
401 |
[ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}" |
[ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}" |
402 |
|
|
403 |
echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..." |
echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..." |
404 |
|
|
405 |
|
# activate the interface |
406 |
|
ifconfig "${iface}" up |
407 |
|
|
408 |
# setup static or dhcp |
# setup static or dhcp |
409 |
case ${NETWORKING} in |
case ${NETWORKING} in |
410 |
dhcp|DHCP) |
dhcp|DHCP) |
428 |
echo -e ${COLOREDSTAR}"Setting up default gateway for ${COLBLUE}${iface}${COLDEFAULT} ..." |
echo -e ${COLOREDSTAR}"Setting up default gateway for ${COLBLUE}${iface}${COLDEFAULT} ..." |
429 |
route add default gateway ${GATEWAY} metric 1 dev ${iface} |
route add default gateway ${GATEWAY} metric 1 dev ${iface} |
430 |
evaluate_retval |
evaluate_retval |
431 |
|
|
432 |
|
unset GATEWAY |
433 |
fi |
fi |
434 |
|
|
435 |
# setup /etc/resolv.conf |
# setup /etc/resolv.conf |
443 |
do |
do |
444 |
echo "nameserver ${dns}" >> /etc/resolv.conf |
echo "nameserver ${dns}" >> /etc/resolv.conf |
445 |
done |
done |
446 |
|
|
447 |
|
unset NAMESERVER |
448 |
fi |
fi |
449 |
done |
done |
450 |
|
|