Magellan Linux

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

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

trunk/magellan-initscripts/rc/network revision 1263 by niro, Fri Mar 11 17:44:48 2011 UTC trunk/initscripts/sysvinit/rc/network revision 2307 by niro, Thu Jan 2 13:33:22 2014 UTC
# Line 12  Line 12 
12    
13  source /etc/conf.d/rc  source /etc/conf.d/rc
14  source ${rc_functions}  source ${rc_functions}
15    source /etc/conf.d/network
16    
17    wait_online()
18    {
19     local timeout="1"
20     local iface="$2"
21    
22     (( timeout *= 10 ))
23    
24     while [ ! -e /sys/class/net/${iface} ]
25     do
26     (( timeout-- > 0 )) || return 1
27     sleep 0.1
28     done
29    
30     return 0
31    }
32    
33  # read values from files  # read values from files
34  read_value()  read_value()
# Line 96  checkconfig() Line 113  checkconfig()
113   if [[ -z ${NETMASK} ]]   if [[ -z ${NETMASK} ]]
114   then   then
115   rc_echo -n "NETMASK missing in net.${iface}, "   rc_echo -n "NETMASK missing in net.${iface}, "
116   rc_echo "using 255.255.255.0"   rc_echo "using ${DEFAULT_NETMASK}"
117   NETMASK=255.255.255.0   NETMASK="${DEFAULT_NETMASK}"
118   fi   fi
119    
120   if [[ -z ${BROADCAST} ]]   if [[ -z ${BROADCAST} ]]
# Line 111  checkconfig() Line 128  checkconfig()
128   if [[ -z ${DHCP_PROG} ]]   if [[ -z ${DHCP_PROG} ]]
129   then   then
130   rc_echo -n "DHCP_PROG missing in net.${iface},"   rc_echo -n "DHCP_PROG missing in net.${iface},"
131   rc_echo "using default programm /sbin/dhcpcd"   rc_echo "using default programm ${DEFAULT_DHCP_PROG}"
132   DHCP_PROG="/sbin/dhcpcd"   DHCP_PROG="${DEFAULT_DHCP_PROG}"
133   fi   fi
134   [[ -z ${DHCP_START} ]] && DHCP_START="-t 10"   [[ -z ${DHCP_START} ]] && DHCP_START="${DEFAULT_DHCP_START}"
135   [[ -z ${DHCP_STOP} ]] && DHCP_STOP="-k"   [[ -z ${DHCP_STOP} ]] && DHCP_STOP="${DEFAULT_DHCP_STOP}"
136   ;;   ;;
137    
138   esac   esac
# Line 179  config_wireless_wpa() Line 196  config_wireless_wpa()
196   return 1   return 1
197   fi   fi
198    
199   if [ ! -x /sbin/wpa_supplicant ]   if [ ! -x $(type -P wpa_supplicant) ]
200   then   then
201   rc_echo "WPA: wpa_supplicant not installed. Aborting setup."   rc_echo "WPA: wpa_supplicant not installed. Aborting setup."
202   return 1   return 1
# Line 193  config_wireless_wpa() Line 210  config_wireless_wpa()
210   [[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant   [[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant
211    
212   # check the configuration   # check the configuration
213   [[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant.auto   [[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant/wpa_supplicant.auto
214   [[ -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
215    
216   # use wext as default driver, do not abort here anymore   # use wext as default driver, do not abort here anymore
# Line 220  config_wireless_wpa() Line 237  config_wireless_wpa()
237   fi   fi
238    
239   # remove old state dir   # remove old state dir
240   [ -d /var/run/wpa_supplicant ] && rm -rf /var/run/wpa_supplicant   [ -d /run/wpa_supplicant ] && rm -rf /run/wpa_supplicant
241    
242   # now run the wpa_supplicant dameon   # now run the wpa_supplicant dameon
243   wpa_supplicant -B \   wpa_supplicant -B \
# Line 355  config_bridge_devices() Line 372  config_bridge_devices()
372   fi   fi
373    
374   # first check for brctl   # first check for brctl
375   if [[ -z $(which brctl) ]]   if [[ -z $(type -P brctl) ]]
376   then   then
377   rc_echo "brctl not found! Please install 'net-misc/bridge-utils'."   rc_echo "brctl not found! Please install 'net-misc/bridge-utils'."
378   return 1   return 1
# Line 459  networking_start() Line 476  networking_start()
476   source ${rc_network_settings}/net.${iface} || exit 1   source ${rc_network_settings}/net.${iface} || exit 1
477   checkconfig   checkconfig
478    
479     # wait until the device is created
480     wait_online 5 "${iface}" || { rc_echo "device '${iface}' does not exist"; continue; }
481    
482   # setup mac   # setup mac
483   if [[ -n ${FORCE_MAC_TO} ]]   if [[ -n ${FORCE_MAC_TO} ]]
484   then   then
# Line 474  networking_start() Line 494  networking_start()
494   fi   fi
495    
496   # now configure wireless_extensions   # now configure wireless_extensions
497   [ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}"   [ -x $(type -P iwconfig) ] && setup_wireless_extensions "${iface}"
498    
499   rc_print "Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..."   rc_print "Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..."
500    
# Line 487  networking_start() Line 507  networking_start()
507   ${CURS_UP}   ${CURS_UP}
508   ${SET_WWCOL}   ${SET_WWCOL}
509   rc_echo "[DHCP]"   rc_echo "[DHCP]"
510   loadproc "${DHCP_PROG}" "${DHCP_START}" "${iface}"   loadproc ${DHCP_PROG} ${DHCP_START} "${iface}"
511   ;;   ;;
512   static|STATIC)   static|STATIC)
513   ${CURS_UP}   ${CURS_UP}
# Line 514  networking_start() Line 534  networking_start()
534   then   then
535   rc_print "Setting up all nameserver for ${COLBLUE}${iface}${COLDEFAULT} ..."   rc_print "Setting up all nameserver for ${COLBLUE}${iface}${COLDEFAULT} ..."
536    
537   # whipe out the old one   # wipe out the old one
538   echo "# Generated by the magellan-initscripts for ${iface}" > /etc/resolv.conf   echo "# Generated by the magellan-initscripts for ${iface}" > /etc/resolv.conf
539   # include head   # include head
540   if [ -f /etc/resolv.conf.head ]   if [ -f /etc/resolv.conf.head ]
# Line 586  networking_stop() Line 606  networking_stop()
606   fi   fi
607    
608   # shutdown dhcp-daemon   # shutdown dhcp-daemon
609   if [[ ${NETWORKING} = dhcp ]] && [[ -n $(pidof ${DHCP_PROG}) ]]   if [[ ${NETWORKING} = dhcp ]] && [[ -n $(pidof $(basename ${DHCP_PROG})) ]]
610   then   then
611   rc_print "Stopping the dhcp-daemon ..."   rc_print "Stopping the dhcp-daemon ..."
612   ${CURS_UP}   ${CURS_UP}
# Line 610  networking_stop() Line 630  networking_stop()
630   done   done
631    
632   # remove state dir   # remove state dir
633   if [ -d /var/run/wpa_supplicant ]   if [ -d /run/wpa_supplicant ]
634   then   then
635   rm -rf /var/run/wpa_supplicant   rm -rf /run/wpa_supplicant
636   fi   fi
637    
638   # delete user routes   # delete user routes

Legend:
Removed from v.1263  
changed lines
  Added in v.2307