Magellan Linux

Diff of /trunk/initscripts/systemd/units/scripts/network.sh

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

revision 1382 by niro, Sat Jun 4 22:43:57 2011 UTC revision 2312 by niro, Thu Jan 2 14:21:05 2014 UTC
# Line 5  Line 5 
5  # get default settings  # get default settings
6  source /etc/conf.d/network  source /etc/conf.d/network
7    
8    wait_online()
9    {
10     local timeout="$1"
11     local iface="$2"
12    
13     (( timeout *= 10 ))
14    
15     while [ ! -e /sys/class/net/${iface} ]
16     do
17     (( timeout-- > 0 )) || return 1
18     echo "waiting 0.1 seconds for device '${iface}' - timeout->'${timeout}'"
19     sleep 0.1
20     done
21    
22     return 0
23    }
24    
25  # read values from files  # read values from files
26  read_value()  read_value()
27  {  {
# Line 167  config_wireless_wpa() Line 184  config_wireless_wpa()
184   return 1   return 1
185   fi   fi
186    
187   if [ ! -x /sbin/wpa_supplicant ]   if [ ! -x $(type -P wpa_supplicant) ]
188   then   then
189   echo "WPA: wpa_supplicant not installed. Aborting setup."   echo "WPA: wpa_supplicant not installed. Aborting setup."
190   return 1   return 1
# Line 177  config_wireless_wpa() Line 194  config_wireless_wpa()
194   [[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant   [[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant
195    
196   # check the configuration   # check the configuration
197   [[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant.auto   [[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant/wpa_supplicant.auto
198   [[ -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
199    
200   # use wext as default driver, do not abort here anymore   # use wext as default driver, do not abort here anymore
# Line 204  config_wireless_wpa() Line 221  config_wireless_wpa()
221   fi   fi
222    
223   # remove old state dir   # remove old state dir
224   [ -d /var/run/wpa_supplicant ] && rm -rf /var/run/wpa_supplicant   [ -d /run/wpa_supplicant ] && rm -rf /run/wpa_supplicant
225    
226   # now run the wpa_supplicant dameon   # now run the wpa_supplicant dameon
227   wpa_supplicant -B \   wpa_supplicant -B \
# Line 328  config_bridge_devices() Line 345  config_bridge_devices()
345   fi   fi
346    
347   # first check for brctl   # first check for brctl
348   if [[ -z $(which brctl) ]]   if [[ -z $(type -P brctl) ]]
349   then   then
350   echo "brctl not found! Please install 'net-misc/bridge-utils'."   echo "brctl not found! Please install 'net-misc/bridge-utils'."
351   return 1   return 1
# Line 428  networking_start() Line 445  networking_start()
445   source /etc/conf.d/net.${iface} || exit 1   source /etc/conf.d/net.${iface} || exit 1
446   checkconfig   checkconfig
447    
448     # wait until the device is created
449     wait_online 5 "${iface}" || { echo "device '${iface}' does not exist"; continue; }
450    
451   # setup mac   # setup mac
452   if [[ -n ${FORCE_MAC_TO} ]]   if [[ -n ${FORCE_MAC_TO} ]]
453   then   then
# Line 441  networking_start() Line 461  networking_start()
461   fi   fi
462    
463   # now configure wireless_extensions   # now configure wireless_extensions
464   [ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}"   [ -x $(type -P iwconfig) ] && setup_wireless_extensions "${iface}"
465    
466   # activate the interface   # activate the interface
467   ifconfig "${iface}" up   ifconfig "${iface}" up
# Line 555  networking_stop() Line 575  networking_stop()
575   done   done
576    
577   # remove state dir   # remove state dir
578   if [ -d /var/run/wpa_supplicant ]   if [ -d /run/wpa_supplicant ]
579   then   then
580   rm -rf /var/run/wpa_supplicant   rm -rf /run/wpa_supplicant
581   fi   fi
582    
583   # delete user routes   # delete user routes

Legend:
Removed from v.1382  
changed lines
  Added in v.2312