lib.sh: simplify download()
Signed-off-by: Leah Rowe <leah@libreboot.org>audit2-merge1
parent
79fb79d239
commit
9e2584fbd9
|
@ -232,15 +232,14 @@ download()
|
||||||
dl_fail="y" # 1 url, 2 url backup, 3 destination, 4 checksum
|
dl_fail="y" # 1 url, 2 url backup, 3 destination, 4 checksum
|
||||||
vendor_checksum "$4" "$3" || dl_fail="n"
|
vendor_checksum "$4" "$3" || dl_fail="n"
|
||||||
[ "$dl_fail" = "n" ] && e "$3" f && return 0
|
[ "$dl_fail" = "n" ] && e "$3" f && return 0
|
||||||
x_ mkdir -p "${3%/*}"
|
x_ mkdir -p "${3%/*}" && for url in "$1" "$2"; do
|
||||||
for url in "$1" "$2"; do
|
|
||||||
[ "$dl_fail" = "n" ] && break
|
[ "$dl_fail" = "n" ] && break
|
||||||
[ -z "$url" ] && continue
|
[ -z "$url" ] && continue
|
||||||
x_ rm -f "$3"
|
x_ rm -f "$3"
|
||||||
curl --location --retry 3 -A "$_ua" "$url" -o "$3" || \
|
curl --location --retry 3 -A "$_ua" "$url" -o "$3" || \
|
||||||
wget --tries 3 -U "$_ua" "$url" -O "$3" || continue
|
wget --tries 3 -U "$_ua" "$url" -O "$3" || continue
|
||||||
vendor_checksum "$4" "$3" || dl_fail="n"
|
vendor_checksum "$4" "$3" || dl_fail="n"
|
||||||
done
|
done;
|
||||||
[ "$dl_fail" = "y" ] && $err "$1 $2 $3 $4: file missing"; return 0
|
[ "$dl_fail" = "y" ] && $err "$1 $2 $3 $4: file missing"; return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue