--- trunk/magellan-initscripts/etc/rc.d/init.d/network 2007/12/13 12:06:22 636 +++ trunk/magellan-initscripts/etc/rc.d/init.d/network 2009/05/21 13:41:38 872 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/network,v 1.14 2007-12-13 12:06:22 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 $ #%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k #%start: 20 @@ -10,7 +10,7 @@ #%before: #%after: -source /etc/sysconfig/rc +source /etc/conf.d/rc source ${rc_functions} # read values from files @@ -24,7 +24,7 @@ # global local ONBOOT local NETWORKING - + # static local IP local NETMASK @@ -182,11 +182,9 @@ # check the configuration [[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant.auto [[ -z ${WIRELESS_WPA_SKEL} ]] && WIRELESS_WPA_SKEL=/etc/conf.d/wpa_supplicant.skel - if [[ -z ${WIRELESS_WPA_DRIVER} ]] - then - echo "WPA: WIRELESS_WPA_DRIVER given. Aborting setup." - return 1 - fi + + # use wext as default driver, do not abort here anymore + [[ -z ${WIRELESS_WPA_DRIVER} ]] && WIRELESS_WPA_DRIVER=wext # write a config with the settings from net.${iface} # only wpa-psk ! all other needs manual setup @@ -195,9 +193,16 @@ # write default cfg from skeleton cat ${WIRELESS_WPA_SKEL} > ${WIRELESS_WPA_CONFIG} + local wpa_proto + case ${WIRELESS_AUTH_MODE} in + wpa) wpa_proto="WPA" ;; + wpa2) wpa_proto="WPA2" ;; + esac + # setup the network entry sed -i -e "s:@WIRELESS_ESSID@:${WIRELESS_ESSID}:g" \ - -e "s:@WIRELESS_KEY@:${WIRELESS_KEY}:g" \ + -e "s:@WIRELESS_KEY@:${WIRELESS_KEY_ASCII}:g" \ + -e "s:@WIRELESS_AUTH_MODE@:${wpa_proto}:g" \ ${WIRELESS_WPA_CONFIG} fi @@ -245,9 +250,9 @@ [[ -n ${WIRELESS_NICK} ]] && iwconfig "${iface}" nick "${WIRELESS_NICK}" case "${WIRELESS_AUTH_MODE}" in - wpa) config_wireless_wpa "${iface}" ;; - wep|on) config_wireless_wep "${iface}" ;; - off) iwconfig "${iface}" enc off ;; + wpa|wpa2) config_wireless_wpa "${iface}" ;; + wep|on) config_wireless_wep "${iface}" ;; + off) iwconfig "${iface}" enc off ;; esac } @@ -277,9 +282,9 @@ fi # check the config - if [[ -z ${BRIDGE_INTERFACE} ]] + if [[ -z ${BRIDGE_INTERFACES} ]] then - echo "BRIDGE: no \$BRIDGE_INTERFACE given. Aborting setup." + echo "BRIDGE: no \$BRIDGE_INTERFACES given. Aborting setup." return 1 fi @@ -295,7 +300,7 @@ brctl addif ${iface} ${bport} done # enable spanning-tree protocol - case BRIDGE_STP in + case ${BRIDGE_STP} in on|off) brctl stp ${iface} ${BRIDGE_STP} ;; *) echo "BRIDGE: unkown value \$BRIDGE_STP='$BRIDGE_STP'."; return 1 ;; esac @@ -390,14 +395,14 @@ config_bridge_devices ${iface} add fi - # activate the interface - ifconfig "${iface}" up - # now configure wireless_extensions [ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}" echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..." + # activate the interface + ifconfig "${iface}" up + # setup static or dhcp case ${NETWORKING} in dhcp|DHCP) @@ -421,6 +426,8 @@ echo -e ${COLOREDSTAR}"Setting up default gateway for ${COLBLUE}${iface}${COLDEFAULT} ..." route add default gateway ${GATEWAY} metric 1 dev ${iface} evaluate_retval + + unset GATEWAY fi # setup /etc/resolv.conf @@ -434,6 +441,8 @@ do echo "nameserver ${dns}" >> /etc/resolv.conf done + + unset NAMESERVER fi done