Move carrier detection back into net.sh. Reserve a new hook numbers

This commit is contained in:
Roy Marples 2007-04-11 10:40:53 +00:00
parent f754c661f5
commit 64c4d3875d
6 changed files with 19 additions and 14 deletions

View File

@ -12,8 +12,6 @@ _config_vars="$_config_vars dhcp pump"
pump_start() { pump_start() {
local args= opt= opts= local args= opt= opts=
_wait_for_carrier || return 1
# Get our options # Get our options
eval opts=\$dhcp_${IFVAR} eval opts=\$dhcp_${IFVAR}
[ -z "${opts}" ] && opts=${dhcp} [ -z "${opts}" ] && opts=${dhcp}

View File

@ -13,8 +13,6 @@ udhcpc_start() {
local args= opt= opts= pidfile="/var/run/udhcpc-${IFACE}.pid" local args= opt= opts= pidfile="/var/run/udhcpc-${IFACE}.pid"
local sendhost=true cachefile="/var/cache/udhcpc-${IFACE}.lease" local sendhost=true cachefile="/var/cache/udhcpc-${IFACE}.lease"
_wait_for_carrier || return 1
eval args=\$udhcpc_${IFVAR} eval args=\$udhcpc_${IFVAR}
# Get our options # Get our options

View File

@ -13,8 +13,6 @@ dhclient_start() {
local args= opt= opts= pidfile="/var/run/dhclient-${IFACE}.pid" local args= opt= opts= pidfile="/var/run/dhclient-${IFACE}.pid"
local sendhost=true dconf= local sendhost=true dconf=
_wait_for_carrier || return 1
# Get our options # Get our options
eval opts=\$dhcp_${IFVAR} eval opts=\$dhcp_${IFVAR}
[ -z "${opts}" ] && opts=${dhcp} [ -z "${opts}" ] && opts=${dhcp}

View File

@ -15,8 +15,6 @@ _config_vars="$_config_vars dhcp dhcpcd"
dhcpcd_start() { dhcpcd_start() {
local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid" local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid"
_wait_for_carrier || return 1
eval args=\$dhcpcd_${IFVAR} eval args=\$dhcpcd_${IFVAR}
# Get our options # Get our options

View File

@ -68,13 +68,15 @@ _wait_for_carrier() {
sleep 1 sleep 1
if _has_carrier ; then if _has_carrier ; then
[ -z "${RC_EBUFFER}" ] && echo [ -z "${RC_EBUFFER}" ] && echo
eend 0
return 0 return 0
fi fi
timeout=$((${timeout} - 1)) timeout=$((${timeout} - 1))
[ -z "${RC_EBUFFER}" ] && echo -n "." [ -z "${RC_EBUFFER}" ] && printf "."
done done
echo [ -z "${RC_EBUFFER}" ] && echo
eend 1
return 1 return 1
} }
@ -392,6 +394,16 @@ start() {
fi fi
done done
if ! _wait_for_carrier ; then
if service_started devd ; then
ewarn "no carrier, but devd will start us when we have one"
mark_service_inactive "${SVCNAME}"
else
eerror "no carrier"
fi
return 1
fi
local config= config_index= local config= config_index=
_load_config _load_config
config_index=0 config_index=0

View File

@ -135,10 +135,11 @@ void rc_free_deptree (rc_depinfo_t *deptree);
typedef enum typedef enum
{ {
rc_hook_runlevel_stop_in = 1, rc_hook_runlevel_stop_in = 1,
rc_hook_runlevel_stop_out, rc_hook_runlevel_stop_out = 4,
rc_hook_runlevel_start_in, rc_hook_runlevel_start_in = 5,
rc_hook_runlevel_start_out, rc_hook_runlevel_start_out = 8,
rc_hook_service_stop_in, /* We reserved a few numbers if we need rc_runlevel_stop_now and done */
rc_hook_service_stop_in = 101,
rc_hook_service_stop_now, rc_hook_service_stop_now,
rc_hook_service_stop_done, rc_hook_service_stop_done,
rc_hook_service_stop_out, rc_hook_service_stop_out,