From 64c4d3875d610191658fb05d9317086fdb72257c Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 11 Apr 2007 10:40:53 +0000 Subject: [PATCH] Move carrier detection back into net.sh. Reserve a new hook numbers --- net.Linux/pump.sh | 2 -- net.Linux/udhcpc.sh | 2 -- net/dhclient.sh | 2 -- net/dhcpcd.sh | 2 -- sh/net.sh | 16 ++++++++++++++-- src/rc.h | 9 +++++---- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/net.Linux/pump.sh b/net.Linux/pump.sh index fd57fcda..f76cfcda 100644 --- a/net.Linux/pump.sh +++ b/net.Linux/pump.sh @@ -12,8 +12,6 @@ _config_vars="$_config_vars dhcp pump" pump_start() { local args= opt= opts= - _wait_for_carrier || return 1 - # Get our options eval opts=\$dhcp_${IFVAR} [ -z "${opts}" ] && opts=${dhcp} diff --git a/net.Linux/udhcpc.sh b/net.Linux/udhcpc.sh index e59d0049..047ab727 100644 --- a/net.Linux/udhcpc.sh +++ b/net.Linux/udhcpc.sh @@ -13,8 +13,6 @@ udhcpc_start() { local args= opt= opts= pidfile="/var/run/udhcpc-${IFACE}.pid" local sendhost=true cachefile="/var/cache/udhcpc-${IFACE}.lease" - _wait_for_carrier || return 1 - eval args=\$udhcpc_${IFVAR} # Get our options diff --git a/net/dhclient.sh b/net/dhclient.sh index 14838d00..dc013379 100644 --- a/net/dhclient.sh +++ b/net/dhclient.sh @@ -13,8 +13,6 @@ dhclient_start() { local args= opt= opts= pidfile="/var/run/dhclient-${IFACE}.pid" local sendhost=true dconf= - _wait_for_carrier || return 1 - # Get our options eval opts=\$dhcp_${IFVAR} [ -z "${opts}" ] && opts=${dhcp} diff --git a/net/dhcpcd.sh b/net/dhcpcd.sh index f90f3336..f8e81f98 100644 --- a/net/dhcpcd.sh +++ b/net/dhcpcd.sh @@ -15,8 +15,6 @@ _config_vars="$_config_vars dhcp dhcpcd" dhcpcd_start() { local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid" - _wait_for_carrier || return 1 - eval args=\$dhcpcd_${IFVAR} # Get our options diff --git a/sh/net.sh b/sh/net.sh index 22c22150..3f62105b 100755 --- a/sh/net.sh +++ b/sh/net.sh @@ -68,13 +68,15 @@ _wait_for_carrier() { sleep 1 if _has_carrier ; then [ -z "${RC_EBUFFER}" ] && echo + eend 0 return 0 fi timeout=$((${timeout} - 1)) - [ -z "${RC_EBUFFER}" ] && echo -n "." + [ -z "${RC_EBUFFER}" ] && printf "." done - echo + [ -z "${RC_EBUFFER}" ] && echo + eend 1 return 1 } @@ -392,6 +394,16 @@ start() { fi 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= _load_config config_index=0 diff --git a/src/rc.h b/src/rc.h index e86531c9..b6c8cdb1 100644 --- a/src/rc.h +++ b/src/rc.h @@ -135,10 +135,11 @@ void rc_free_deptree (rc_depinfo_t *deptree); typedef enum { rc_hook_runlevel_stop_in = 1, - rc_hook_runlevel_stop_out, - rc_hook_runlevel_start_in, - rc_hook_runlevel_start_out, - rc_hook_service_stop_in, + rc_hook_runlevel_stop_out = 4, + rc_hook_runlevel_start_in = 5, + rc_hook_runlevel_start_out = 8, + /* 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_done, rc_hook_service_stop_out,