Skip to content

Commit

Permalink
Improve curl and wget usage
Browse files Browse the repository at this point in the history
This hopefully avoids some build errors in case of connectivity issues.
  • Loading branch information
fniephaus committed Jun 4, 2020
1 parent 536d40f commit 15a1e43
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,14 @@ download_file() {
fi

if program_exists "curl"; then
curl -f -s -L --retry 3 -o "${target}" "${url}" || print_error_and_exit \
"curl failed to download ${url} to '${target}'."
curl --fail --silent --show-error --location \
--retry 3 --retry-connrefused --retry-delay 5 --max-time 30 \
-o "${target}" "${url}" || print_error_and_exit \
"curl failed to download ${url} to '${target}'."
elif program_exists "wget"; then
wget -q -O "${target}" "${url}" || print_error_and_exit \
"wget failed to download ${url} to '${target}'."
wget -t 3 --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 \
--no-dns-cache -q -O "${target}" "${url}" || print_error_and_exit \
"wget failed to download ${url} to '${target}'."
else
print_error_and_exit "Please install curl or wget."
fi
Expand Down

0 comments on commit 15a1e43

Please sign in to comment.