提交 f21499f4 作者: mateon1

Make dist_get fallback to other downloaders if one fails

License: MIT
Signed-off-by: 's avatarMateusz Naściszewski <matin1111@wp.pl>
上级 24a32bf9
...@@ -25,17 +25,26 @@ download() { ...@@ -25,17 +25,26 @@ download() {
if have_binary wget; then if have_binary wget; then
printf '==> Using wget to download "%s" to "%s"\n' "$dl_url" "$dl_output" printf '==> Using wget to download "%s" to "%s"\n' "$dl_url" "$dl_output"
wget "$dl_url" -O "$dl_output" || return if wget "$dl_url" -O "$dl_output"; then
elif have_binary curl; then echo "==> download complete!"
return
fi
fi
if have_binary curl; then
printf '==> Using curl to download "%s" to "%s"\n' "$dl_url" "$dl_output" printf '==> Using curl to download "%s" to "%s"\n' "$dl_url" "$dl_output"
curl --silent "$dl_url" > "$dl_output" || return if curl --silent "$dl_url" > "$dl_output"; then
elif have_binary fetch; then echo "==> download complete!"
printf '==> Using fetch to download "%s" to "%s"\n' "$dl_url" "$dl_output" return
fetch "$dl_url" -o "$dl_output" || return fi
else
die "no binary found to download $dl_url. exiting."
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!" echo "==> download complete!"
return
fi
fi
die "Unable to download $dl_url. exiting."
} }
unarchive() { unarchive() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论