diff options
author | Erich Eckner <git@eckner.net> | 2019-10-15 12:02:18 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-10-15 12:02:18 +0200 |
commit | 9c890630d38d1a86aa2213e1cd02233970924cf9 (patch) | |
tree | 3d615b4b4537e43a620d01a33ffc72a1756747f4 /checkVersions | |
parent | ce283683f59a812510a3bc2c2823e1a32a5d67d5 (diff) | |
download | archlinuxewe.git.save-9c890630d38d1a86aa2213e1cd02233970924cf9.tar.xz |
checkVersions: try to download upto 5 times through the proxy
Diffstat (limited to 'checkVersions')
-rwxr-xr-x | checkVersions | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/checkVersions b/checkVersions index 17432f03..f75deb80 100755 --- a/checkVersions +++ b/checkVersions @@ -13,6 +13,7 @@ usage() { curl_it() { local source="$1" local cache_file + local i cache_file=$( { printf '%s\n' "$1" @@ -32,14 +33,19 @@ curl_it() { return fi tmp_file=$(mktemp) - curl --compressed -o "${tmp_file}" --connect-timeout 10 -s -x socks5://127.0.0.1:9050 "$@" "${source}" - if grep -qiF "$( - printf '%s\n' \ - 'access denied' \ - 'Repository seems to be empty' - )" "${tmp_file}"; then - : >"${tmp_file}" - fi + for i in {1..5}; do + curl --compressed -o "${tmp_file}" --connect-timeout 10 -s -x socks5://127.0.0.1:9050 "$@" "${source}" + if grep -qiF "$( + printf '%s\n' \ + 'access denied' \ + 'Repository seems to be empty' + )" "${tmp_file}"; then + : >"${tmp_file}" + fi + if [ -s "${tmp_file}" ]; then + break + fi + done if [ ! -s "${tmp_file}" ]; then curl --compressed -o "${tmp_file}" --connect-timeout 10 -s "$@" "${source}" fi |