diff -urN baselayout-1.12.11.1/etc/conf.d/rc baselayout-1.12.11.1-patched/etc/conf.d/rc --- baselayout-1.12.11.1/etc/conf.d/rc 2007-10-24 08:29:26.000000000 +0930 +++ baselayout-1.12.11.1-patched/etc/conf.d/rc 2009-05-04 21:12:34.000000000 +0930 @@ -60,6 +60,13 @@ RC_NET_STRICT_CHECKING="no" +# RC_UP_INTERFACE_TIMEOUT allows you to specify a timeout period in seconds +# to wait before any network interface (besides net.lo) receives or gains an IP address. +# This is useful for networks that use DHCP, wireless authentication methods, +# or any other method that requires time to pass before the interface receives an IP. + +RC_UP_INTERFACE_TIMEOUT="20" + # RC_DOWN_INTERFACE allows you to specify if RC will bring the interface # completely down when it stops. The default is yes, but there are some # instances where you may not want this to happen such as using Wake On LAN. diff -urN baselayout-1.12.11.1/lib/rcscripts/net/wpa_supplicant.sh baselayout-1.12.11.1-patched/lib/rcscripts/net/wpa_supplicant.sh --- baselayout-1.12.11.1/lib/rcscripts/net/wpa_supplicant.sh 2007-10-24 08:29:26.000000000 +0930 +++ baselayout-1.12.11.1-patched/lib/rcscripts/net/wpa_supplicant.sh 2009-05-04 21:59:56.000000000 +0930 @@ -145,7 +145,7 @@ timeout="associate_timeout_${ifvar}" timeout="${!timeout:--1}" - [[ -z ${actfile} && ${timeout} -lt 0 ]] && timeout="60" + [[ -n ${actfile} && ${timeout} -lt 0 ]] && timeout="60" if [[ ${timeout} == "0" ]] ; then ewarn "WARNING: infinite timeout set for association on ${iface}" diff -urN baselayout-1.12.11.1/sbin/rc baselayout-1.12.11.1-patched/sbin/rc --- baselayout-1.12.11.1/sbin/rc 2007-10-24 08:29:27.000000000 +0930 +++ baselayout-1.12.11.1-patched/sbin/rc 2009-05-04 21:13:38.000000000 +0930 @@ -166,7 +166,7 @@ CRITICAL_SERVICES="${CRITICAL_SERVICES} ${x##*/}" done else - CRITICAL_SERVICES="checkroot modules checkfs localmount clock bootmisc" + CRITICAL_SERVICES="checkroot modules" fi export CRITICAL_SERVICES @@ -861,7 +861,34 @@ # Start scripts for i in $(get_start_services) ; do if service_stopped "${i}" ; then - do_interactive start_service "${i}" + # If service is a 'net' service, wait for the interface to be setup + if net_service "${i}" && [[ "${i}" != net.lo ]] ; then + do_interactive start_service "${i}" + ebegin "Configuring network interface" + sleep 1 + if ! is_net_up ; then + einfon " Waiting for network interface to come up ." + cnt=0 + while ! is_net_up ; do + cnt=$(expr $cnt + 1) + if [ $cnt -gt ${RC_UP_INTERFACE_TIMEOUT} ] ; then + echo + eend 1 "Failed." + break + fi + sleep 2 + echo -n "." + done + echo + fi + eend 0 + # Only start 'net' dependant services if network is up + elif dependon "${i}" net ; then + is_net_up && do_interactive start_service "${i}" || \ + eerror ""${i}" not started (no IP address present for any interfaces)!" + else + do_interactive start_service "${i}" + fi fi done diff -urN baselayout-1.12.11.1/sbin/rc-services.sh baselayout-1.12.11.1-patched/sbin/rc-services.sh --- baselayout-1.12.11.1/sbin/rc-services.sh 2008-01-02 04:51:46.000000000 +1030 +++ baselayout-1.12.11.1-patched/sbin/rc-services.sh 2009-05-04 21:10:46.000000000 +0930 @@ -754,11 +754,7 @@ return 0 ;; *) - for x in $(dolisting "${svcdir}/started/net.*") ; do - local y="${x##*/}" - [[ ${y} == "$1" ]] && continue - [[ ${y} != "net.lo" ]] && return 0 - done + [[ -n $(ifconfig -a | grep "inet addr:" | grep -v 127.0.0.1) ]] && return 0 return 1 ;; esac