From 4863b61919fa1187bde16fbf947d65be0a8d932b Mon Sep 17 00:00:00 2001 From: "Rodrigo Q. Saramago" Date: Tue, 31 Jan 2023 00:15:06 +0100 Subject: [PATCH] Add maximum number of download attempts --- scripts/release_ppa.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/release_ppa.sh b/scripts/release_ppa.sh index f695f8705..7958cd0fe 100755 --- a/scripts/release_ppa.sh +++ b/scripts/release_ppa.sh @@ -84,13 +84,14 @@ declare -A dependencies2=( ) declare -n dependencies +max_attempts=30 try_download_dependencies() { output_dir="./solc/deps/downloads" - mkdir -p $output_dir 2>/dev/null || true + mkdir -p "$output_dir" 2>/dev/null || true for dependencies in ${!dependencies@} do - for (( i=0;; i++ )) + for (( i=1;; i++ )) do echo "Attempt $i to download ${dependencies[package]}..." filename="${output_dir}/${dependencies[package]}.tar.gz" @@ -107,6 +108,12 @@ try_download_dependencies() { echo "Retrying..." rm -f "$filename" fi + if (( max_attempts == i )) + then + fail "Maximum number of download attemps reached (max=${max_attempts}). Giving up..." + exit 1 + fi + sleep 1 done done }