diff mbox series

[OSSTEST,1/7] mg-debian-installer-update: Honour redirect for dtbs

Message ID 20210209175904.28282-1-iwj@xenproject.org (mailing list archive)
State New, archived
Headers show
Series [OSSTEST,1/7] mg-debian-installer-update: Honour redirect for dtbs | expand

Commit Message

Ian Jackson Feb. 9, 2021, 5:58 p.m. UTC
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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mg-debian-installer-update b/mg-debian-installer-update
index fb4fe2ab..5e890d34 100755
--- a/mg-debian-installer-update
+++ b/mg-debian-installer-update
@@ -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