1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $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 $ |
# $Id$ |
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 |
103 |
dhcp) |
dhcp) |
104 |
if [[ -z ${DHCP_PROG} ]] |
if [[ -z ${DHCP_PROG} ]] |
105 |
then |
then |
106 |
echo "DHCP_PROG missing in net.${interface}, aborted" |
echo -n "DHCP_PROG missing in net.${interface}," |
107 |
exit 1 |
echo "using default programm" |
108 |
|
DHCP_PROG="/sbin/dhcpcd" |
109 |
fi |
fi |
110 |
|
[[ -z ${DHCP_START} ]] && DHCP_START="-t 10" |
111 |
|
[[ -z ${DHCP_STOP} ]] && DHCP_STOP="-k" |
112 |
;; |
;; |
113 |
|
|
114 |
esac |
esac |
185 |
# check the configuration |
# check the configuration |
186 |
[[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant.auto |
[[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant.auto |
187 |
[[ -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 |
188 |
if [[ -z ${WIRELESS_WPA_DRIVER} ]] |
|
189 |
then |
# use wext as default driver, do not abort here anymore |
190 |
echo "WPA: WIRELESS_WPA_DRIVER given. Aborting setup." |
[[ -z ${WIRELESS_WPA_DRIVER} ]] && WIRELESS_WPA_DRIVER=wext |
|
return 1 |
|
|
fi |
|
191 |
|
|
192 |
# write a config with the settings from net.${iface} |
# write a config with the settings from net.${iface} |
193 |
# only wpa-psk ! all other needs manual setup |
# only wpa-psk ! all other needs manual setup |
385 |
checkconfig |
checkconfig |
386 |
|
|
387 |
# setup mac |
# setup mac |
388 |
if [ -n "${FORCE_MAC_TO}" ] |
if [[ -n ${FORCE_MAC_TO} ]] |
389 |
then |
then |
390 |
echo -e ${COLOREDSTAR}"Faking MAC to ${FORCE_MAC_TO} for ${COLBLUE}${iface}${COLDEFAULT} ... " |
echo -e ${COLOREDSTAR}"Faking MAC to ${FORCE_MAC_TO} for ${COLBLUE}${iface}${COLDEFAULT} ... " |
391 |
ifconfig "${iface}" hw ether "${FORCE_MAC_TO}" |
ifconfig "${iface}" hw ether "${FORCE_MAC_TO}" |
412 |
${CURS_UP} |
${CURS_UP} |
413 |
${SET_WWCOL} |
${SET_WWCOL} |
414 |
echo "[DHCP]" |
echo "[DHCP]" |
415 |
loadproc ${DHCP_PROG} ${DHCP_START} "${iface}" |
loadproc "${DHCP_PROG}" "${DHCP_START}" "${iface}" |
416 |
;; |
;; |
417 |
static|STATIC) |
static|STATIC) |
418 |
${CURS_UP} |
${CURS_UP} |
434 |
fi |
fi |
435 |
|
|
436 |
# setup /etc/resolv.conf |
# setup /etc/resolv.conf |
437 |
|
# whipe out the old one |
438 |
|
echo "# Generated by the magellan-initscripts for ${iface}" > /etc/resolv.conf |
439 |
|
# include head |
440 |
|
if [ -f /etc/resolv.conf.head ] |
441 |
|
then |
442 |
|
cat /etc/resolv.conf.head >> /etc/resolv.conf |
443 |
|
else |
444 |
|
echo "# /etc/resolv.conf.head can replace this line" >> /etc/resolv.conf |
445 |
|
fi |
446 |
|
# add given nameserver |
447 |
if [[ -n ${NAMESERVER} ]] |
if [[ -n ${NAMESERVER} ]] |
448 |
then |
then |
449 |
echo -e ${COLOREDSTAR}"Setting up all nameserver for ${COLBLUE}${iface}${COLDEFAULT} ..." |
echo -e ${COLOREDSTAR}"Setting up all nameserver for ${COLBLUE}${iface}${COLDEFAULT} ..." |
450 |
|
|
|
# whipe out the old one |
|
|
echo "# Generated by the magellan-initscripts for ${iface}" > /etc/resolv.conf |
|
451 |
for dns in ${NAMESERVER} |
for dns in ${NAMESERVER} |
452 |
do |
do |
453 |
echo "nameserver ${dns}" >> /etc/resolv.conf |
echo "nameserver ${dns}" >> /etc/resolv.conf |
455 |
|
|
456 |
unset NAMESERVER |
unset NAMESERVER |
457 |
fi |
fi |
458 |
|
# include tail |
459 |
|
if [ -f /etc/resolv.conf.tail ] |
460 |
|
then |
461 |
|
cat /etc/resolv.conf.tail >> /etc/resolv.conf |
462 |
|
else |
463 |
|
echo "# /etc/resolv.conf.tail can replace this line" >> /etc/resolv.conf |
464 |
|
fi |
465 |
done |
done |
466 |
|
|
467 |
# setup user routes |
# setup user routes |