Magellan Linux

Diff of /trunk/initscripts/sysvinit/rc/network

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 691 by niro, Sat Mar 22 17:54:46 2008 UTC revision 955 by niro, Sun Dec 27 02:49:25 2009 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $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$
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
# Line 10  Line 10 
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
# Line 103  checkconfig() Line 103  checkconfig()
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
# Line 182  config_wireless_wpa() Line 185  config_wireless_wpa()
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
# Line 195  config_wireless_wpa() Line 196  config_wireless_wpa()
196   # write default cfg from skeleton   # write default cfg from skeleton
197   cat ${WIRELESS_WPA_SKEL} > ${WIRELESS_WPA_CONFIG}   cat ${WIRELESS_WPA_SKEL} > ${WIRELESS_WPA_CONFIG}
198    
199     local wpa_proto
200     case ${WIRELESS_AUTH_MODE} in
201     wpa) wpa_proto="WPA" ;;
202     wpa2) wpa_proto="WPA2" ;;
203     esac
204    
205   # setup the network entry   # setup the network entry
206   sed -i -e "s:@WIRELESS_ESSID@:${WIRELESS_ESSID}:g" \   sed -i -e "s:@WIRELESS_ESSID@:${WIRELESS_ESSID}:g" \
207   -e "s:@WIRELESS_KEY@:${WIRELESS_KEY}:g" \   -e "s:@WIRELESS_KEY@:${WIRELESS_KEY_ASCII}:g" \
208     -e "s:@WIRELESS_AUTH_MODE@:${wpa_proto}:g" \
209   ${WIRELESS_WPA_CONFIG}   ${WIRELESS_WPA_CONFIG}
210   fi   fi
211    
# Line 245  setup_wireless_extensions() Line 253  setup_wireless_extensions()
253   [[ -n ${WIRELESS_NICK} ]] && iwconfig "${iface}" nick "${WIRELESS_NICK}"   [[ -n ${WIRELESS_NICK} ]] && iwconfig "${iface}" nick "${WIRELESS_NICK}"
254    
255   case "${WIRELESS_AUTH_MODE}" in   case "${WIRELESS_AUTH_MODE}" in
256   wpa) config_wireless_wpa "${iface}" ;;   wpa|wpa2) config_wireless_wpa "${iface}" ;;
257   wep|on) config_wireless_wep "${iface}" ;;   wep|on) config_wireless_wep "${iface}" ;;
258   off) iwconfig "${iface}" enc off ;;   off) iwconfig "${iface}" enc off ;;
259   esac   esac
260  }  }
261    
# Line 377  networking_start() Line 385  networking_start()
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}"
# Line 390  networking_start() Line 398  networking_start()
398   config_bridge_devices ${iface} add   config_bridge_devices ${iface} add
399   fi   fi
400    
  # activate the interface  
  ifconfig "${iface}" up  
   
401   # now configure wireless_extensions   # now configure wireless_extensions
402   [ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}"   [ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}"
403    
404   echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..."   echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..."
405    
406     # activate the interface
407     ifconfig "${iface}" up
408    
409   # setup static or dhcp   # setup static or dhcp
410   case ${NETWORKING} in   case ${NETWORKING} in
411   dhcp|DHCP)   dhcp|DHCP)
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}

Legend:
Removed from v.691  
changed lines
  Added in v.955