summaryrefslogtreecommitdiff
path: root/include/lib.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-09 11:04:08 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-09 11:04:08 +0100
commit3440e1f651623cd909c6a2a17a024e754950a61b (patch)
tree63af2ca83a264b5b30c07d864e311e66cbefd6c6 /include/lib.sh
parent75b39dbeb15c7ac0a942da84d1c0784e80b51156 (diff)
lib.sh: simplify download()
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rwxr-xr-xinclude/lib.sh5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/lib.sh b/include/lib.sh
index 25b470bf..5244ce45 100755
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -232,15 +232,14 @@ download()
dl_fail="y" # 1 url, 2 url backup, 3 destination, 4 checksum
vendor_checksum "$4" "$3" || dl_fail="n"
[ "$dl_fail" = "n" ] && e "$3" f && return 0
- x_ mkdir -p "${3%/*}"
- for url in "$1" "$2"; do
+ x_ mkdir -p "${3%/*}" && for url in "$1" "$2"; do
[ "$dl_fail" = "n" ] && break
[ -z "$url" ] && continue
x_ rm -f "$3"
curl --location --retry 3 -A "$_ua" "$url" -o "$3" || \
wget --tries 3 -U "$_ua" "$url" -O "$3" || continue
vendor_checksum "$4" "$3" || dl_fail="n"
- done
+ done;
[ "$dl_fail" = "y" ] && $err "$1 $2 $3 $4: file missing"; return 0
}