]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
mg-debian-installer-update: Honour redirect for dtbs
authorIan Jackson <iwj@xenproject.org>
Tue, 9 Feb 2021 13:03:32 +0000 (13:03 +0000)
committerIan Jackson <iwj@xenproject.org>
Tue, 9 Feb 2021 15:11:42 +0000 (15:11 +0000)
When using snapshots, we can get a redirect and then we don't
recurse.  There doesn't seem to be a suitable option for wget, so do
this by hand before we call wget -m.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
mg-debian-installer-update

index fb4fe2aba1a44f435fcbda60b4df09585d744063..5e890d348f960be87a5a674fc9b301b88a88617e 100755 (executable)
@@ -89,7 +89,12 @@ if [ "x$dtbs" != "x" ] ; then
     # Can't seem to get curl to globs.
     rm -rf dtbs
     mkdir dtbs
-    ( cd dtbs && wget -nv -A README,\*.dtb -nd -nH -np -m  $dtbs )
+    dtbs_redir="$(curl -sSI -o /dev/null -w '%{redirect_url}' $dtbs)"
+    if [ "x$dtbs_redir" != x ]; then
+        dtbs=$dtbs_redir
+        echo "Redirected for dtbs, to $dtbs"
+    fi
+    ( cd dtbs && wget -nv -A README,\*.dtb -nd -nH -np -m  "$dtbs" )
     tar --mtime=./dtbs/README -cf dtbs.tar dtbs
     gzip -9nf dtbs.tar
 fi