summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-07-16 16:22:25 +0200
committerErich Eckner <git@eckner.net>2019-07-16 16:22:25 +0200
commit83b7a2f1047792c645a90f5ab5d10dc93d05b081 (patch)
treea73b25a5904ace42d2883549a3b1dd13b22f90b0
parent16aa1a8af3b8197a6f95e3ea3a36e1492e9b6d7c (diff)
downloadarchlinuxewe-83b7a2f1047792c645a90f5ab5d10dc93d05b081.tar.xz
checkVersions: do not cache negative answers from cgit
-rwxr-xr-xcheckVersions27
1 files changed, 20 insertions, 7 deletions
diff --git a/checkVersions b/checkVersions
index 09641061c..724d6d714 100755
--- a/checkVersions
+++ b/checkVersions
@@ -32,19 +32,32 @@ curl_it() {
fi
tmp_file=$(mktemp)
curl --compressed -o "${tmp_file}" --connect-timeout 10 -s -x socks5://127.0.0.1:9050 "$@" "${source}"
- if grep -qiF 'access denied' "${tmp_file}"; then
+ if grep -qiF "$(
+ printf '%s\n' \
+ 'access denied' \
+ 'Repository seems to be empty'
+ )" "${tmp_file}"; then
: >"${tmp_file}"
fi
if [ ! -s "${tmp_file}" ]; then
curl --compressed -o "${tmp_file}" --connect-timeout 10 -s "$@" "${source}"
fi
cat "${tmp_file}"
- local trials=5
- while [ ${trials} -gt 0 ] && \
- ! mv "${tmp_file}" "${cache_file}"; do
- sleep 1
- trials=$((trials-1))
- done
+ local trials
+ if grep -qiF "$(
+ printf '%s\n' \
+ 'access denied' \
+ 'Repository seems to be empty'
+ )" "${tmp_file}"; then
+ trials=-1
+ else
+ trials=5
+ while [ ${trials} -gt 0 ] && \
+ ! mv "${tmp_file}" "${cache_file}"; do
+ sleep 1
+ trials=$((trials-1))
+ done
+ fi
if [ ${trials} -le 0 ]; then
rm -f "${tmp_file}"
fi