mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-11 11:19:05 +08:00
Make dist_get fallback to other downloaders if one fails
License: MIT Signed-off-by: Mateusz Naściszewski <matin1111@wp.pl>
This commit is contained in:
parent
24a32bf9e8
commit
f21499f449
29
bin/dist_get
29
bin/dist_get
@ -25,17 +25,26 @@ download() {
|
||||
|
||||
if have_binary wget; then
|
||||
printf '==> Using wget to download "%s" to "%s"\n' "$dl_url" "$dl_output"
|
||||
wget "$dl_url" -O "$dl_output" || return
|
||||
elif have_binary curl; then
|
||||
printf '==> Using curl to download "%s" to "%s"\n' "$dl_url" "$dl_output"
|
||||
curl --silent "$dl_url" > "$dl_output" || return
|
||||
elif have_binary fetch; then
|
||||
printf '==> Using fetch to download "%s" to "%s"\n' "$dl_url" "$dl_output"
|
||||
fetch "$dl_url" -o "$dl_output" || return
|
||||
else
|
||||
die "no binary found to download $dl_url. exiting."
|
||||
if wget "$dl_url" -O "$dl_output"; then
|
||||
echo "==> download complete!"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
echo "==> download complete!"
|
||||
if have_binary curl; then
|
||||
printf '==> Using curl to download "%s" to "%s"\n' "$dl_url" "$dl_output"
|
||||
if curl --silent "$dl_url" > "$dl_output"; then
|
||||
echo "==> download complete!"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
if have_binary fetch; then
|
||||
printf '==> Using fetch to download "%s" to "%s"\n' "$dl_url" "$dl_output"
|
||||
if fetch "$dl_url" -o "$dl_output"; then
|
||||
echo "==> download complete!"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
die "Unable to download $dl_url. exiting."
|
||||
}
|
||||
|
||||
unarchive() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user