]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
retry image download forever
authorNathan Rini <nate@ucar.edu>
Wed, 19 Sep 2018 18:05:05 +0000 (12:05 -0600)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 25 Oct 2019 09:37:43 +0000 (11:37 +0200)
modules.d/90livenet/livenetroot.sh

index b7592bc0a12bf418896854c429edebd136ebcf61..b9cbd44495ad03357f4abd770d3941ed69345d44 100755 (executable)
@@ -13,14 +13,17 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 netroot="$2"
 liveurl="${netroot#livenet:}"
 info "fetching $liveurl"
-imgfile=$(fetch_url "$liveurl")
 
-if [ $? != 0 ]; then
-       warn "failed to download live image: error $?"
-       exit 1
-fi
+imgfile=
+until [ ! -z "$imgfile" -a -s "$imgfile" ]
+do
+    imgfile=$(fetch_url "$liveurl")
 
-> /tmp/livenet.downloaded
+    if [ $? != 0 ]; then
+            warn "failed to download live image: error $?"
+            imgfile=
+    fi
+done > /tmp/livenet.downloaded
 
 # TODO: couldn't dmsquash-live-root handle this?
 if [ ${imgfile##*.} = "iso" ]; then