--- trunk/magellan-initscripts/etc/rc.d/init.d/network 2008/03/22 17:54:46 691 +++ trunk/magellan-initscripts/etc/rc.d/init.d/network 2009/12/27 02:49:25 955 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/network,v 1.18 2008-03-22 17:54:46 niro Exp $ +# $Id$ #%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 @@ -103,9 +103,12 @@ dhcp) if [[ -z ${DHCP_PROG} ]] then - echo "DHCP_PROG missing in net.${interface}, aborted" - exit 1 + echo -n "DHCP_PROG missing in net.${interface}," + echo "using default programm" + DHCP_PROG="/sbin/dhcpcd" fi + [[ -z ${DHCP_START} ]] && DHCP_START="-t 10" + [[ -z ${DHCP_STOP} ]] && DHCP_STOP="-k" ;; esac @@ -182,11 +185,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 +196,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 +253,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 } @@ -377,7 +385,7 @@ checkconfig # setup mac - if [ -n "${FORCE_MAC_TO}" ] + if [[ -n ${FORCE_MAC_TO} ]] then echo -e ${COLOREDSTAR}"Faking MAC to ${FORCE_MAC_TO} for ${COLBLUE}${iface}${COLDEFAULT} ... " ifconfig "${iface}" hw ether "${FORCE_MAC_TO}" @@ -390,21 +398,21 @@ 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) ${CURS_UP} ${SET_WWCOL} echo "[DHCP]" - loadproc ${DHCP_PROG} ${DHCP_START} "${iface}" + loadproc "${DHCP_PROG}" "${DHCP_START}" "${iface}" ;; static|STATIC) ${CURS_UP}