From 8fb2720895f0b28e7872c6b887dc29551702382a Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Fri, 22 Apr 2016 12:38:28 +0200 Subject: liveinit: make the DHCP wait time configurable and set a longer default. New boot parameter: dhcpwait= Maximum wait time for the DHCP client to configure a network interface (new default: 20 seconds, was 10 seconds). --- liveinit | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'liveinit') diff --git a/liveinit b/liveinit index c78c8a7..f4bda31 100755 --- a/liveinit +++ b/liveinit @@ -75,6 +75,9 @@ GLAMORACCEL=1 INTERFACE="" NFSHOST="" +# Max wait time for DHCP client to configure an interface: +DHCPWAIT=20 + INITRD=$(cat /initrd-name) WAIT=$(cat /wait-for-root) KEYMAP=$(cat /keymap) @@ -109,6 +112,9 @@ for ARG in $(cat /proc/cmdline); do DEBUG=$(echo $ARG | cut -f2 -d=) DEBUGV="-v" ;; + dhcpwait=*) + DHCPWAIT=$(echo $ARG | cut -f2 -d=) + ;; hostname=*) LIVE_HOSTNAME=$(echo $ARG | cut -f2 -d=) ;; @@ -319,8 +325,6 @@ if [ "$RESCUE" = "" ]; then # Find and configure the network interface for NFS root support. # Assume nothing about the method of network configuration: ENET_MODE="ask" - # Max wait time for DHCP client to configure an interface: - MAXDHCP=10 echo "${MARKER}: Configuring network interface for NFS mount." @@ -360,11 +364,11 @@ if [ "$RESCUE" = "" ]; then continue # skip wireless interfaces fi # If this configures an interface, we're done with dhcpcd afterwards: - /sbin/dhcpcd -L -p -t $MAXDHCP $EDEV & + /sbin/dhcpcd -L -p -t $DHCPWAIT $EDEV & done unset EDEV - # Wait at most MAXDHCP seconds for a DHCP-configured interface to appear: - for ITER in $(seq 0 $MAXDHCP); do + # Wait at most DHCPWAIT seconds for a DHCP-configured interface to appear: + for ITER in $(seq 0 $DHCPWAIT); do if $(ip -f inet -o addr show | grep -v " lo " 1>/dev/null 2>/dev/null) then # Found one! @@ -393,7 +397,7 @@ if [ "$RESCUE" = "" ]; then if [ "$ENET_MODE" = "ask" -o "$ENET_MODE" = "dhcp" ]; then # Invoke dhcpcd only if it was not called yet: if [ ! -s /run/dhcpcd/dhcpcd-${INTERFACE}.pid ]; then - /sbin/dhcpcd -L -p -t $MAXDHCP $INTERFACE + /sbin/dhcpcd -L -p -t $DHCPWAIT $INTERFACE fi else # Kill dhcpcd if we used it to find a statically configured interface: -- cgit v1.2.3