summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-19 16:46:48 +0200
committerSimon Rettberg2019-07-19 16:46:48 +0200
commit3bc1817ed98d0da6f0e81ea7fe3ccc1d3803f844 (patch)
treec213518e95e289d14d3f67bdd6b4da5b757d3085
parent[rootfs-stage31] tarcopy: Ignore directories (diff)
downloadmltk-3bc1817ed98d0da6f0e81ea7fe3ccc1d3803f844.tar.gz
mltk-3bc1817ed98d0da6f0e81ea7fe3ccc1d3803f844.tar.xz
mltk-3bc1817ed98d0da6f0e81ea7fe3ccc1d3803f844.zip
Workaround invalid download checksum files
-rw-r--r--core/includes/downloader.inc3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/includes/downloader.inc b/core/includes/downloader.inc
index b75272e0..3596fa58 100644
--- a/core/includes/downloader.inc
+++ b/core/includes/downloader.inc
@@ -40,6 +40,9 @@ download () {
for f in sha256sums.asc SHA256SUMS md5sums.asc MD5SUMS metadata.xml.gz ""; do
[ -z "$f" ] && break
wget -O "$tmpfile" "$path/$f" || continue
+ # Some ret^W less smart companies decide to just 302 requests for non-existing files/pages
+ [ "$( stat -c %s "$tmpfile" )" -lt 100000 ] || continue
+ [ "$( grep -c '<' "$tmpfile" )" -lt 10 ] || continue
if [ "$f" = "metadata.xml.gz" ]; then
sum=$( gzip -d < "$tmpfile" | grep '<checksum>.*</checksum>' | sed -r 's/<[^>]*>//g' )
[ -z "$sum" ] && perror "Did not find sha256 in $f"