From ab84b05724db9328b170d7daffc4df9f7c270ca2 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 27 Oct 2014 23:29:36 +0100 Subject: [PATCH] Support getfile.retries=... boot option The netscript=... and netscript=... boot options might fail to download the provided argument during bootup in certain environments. Retrieving the IP address via DHCP might take just too long (hello Spanning Tree Protocol!), so the last run of the netscript retrieval is executed without having the network configuration available yet. Explicitly setting the number of retries via getfile.retries=... to something higher than the default (being 10) allows the user to work around this issue. Thanks: Sipwise GmbH for sponsoring my development time Thanks: Christian Hofstaedtler for reviewing --- autoconfig.functions | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autoconfig.functions b/autoconfig.functions index a4cc453..3ab2c02 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -1425,7 +1425,13 @@ get_remote_file() { --read-timeout=10 ${SOURCE} -O ${TARGET} && return 0 || return 1 } einfo "Trying to get ${WHITE}${TARGET}${NORMAL}" - counter=10 + + if checkbootparam 'getfile.retries' ; then + local counter="$(getbootparam 'getfile.retries' 2>>$DEBUG)" + else + local counter=10 + fi + while ! getconfig && [[ "$counter" != 0 ]] ; do echo -n "Sleeping for 1 second and trying to get config again... " counter=$(( counter-1 )) -- 2.1.4