Support getfile.retries=... boot option
authorMichael Prokop <mika@grml.org>
Mon, 27 Oct 2014 22:29:36 +0000 (23:29 +0100)
committerMichael Prokop <mika@grml.org>
Mon, 27 Oct 2014 23:45:11 +0000 (00:45 +0100)
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

index a4cc453..3ab2c02 100755 (executable)
@@ -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 ))