From 9c890630d38d1a86aa2213e1cd02233970924cf9 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 15 Oct 2019 12:02:18 +0200 Subject: checkVersions: try to download upto 5 times through the proxy --- checkVersions | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'checkVersions') 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 -- cgit v1.2.3-54-g00ecf