mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
armbian-next: retry 3 times for loop device's size, then give up; introduce RETRY_RUNS in do_with_retries()
This commit is contained in:
@@ -253,12 +253,14 @@ function do_with_retries() {
|
||||
local counter=0
|
||||
while [[ $counter -lt $retries ]]; do
|
||||
counter=$((counter + 1))
|
||||
declare -i RETRY_RUNS=${counter}
|
||||
"$@" && return 0 # execute and return 0 if success; if not, let it loop;
|
||||
if [[ "${silent_retry}" == "yes" ]]; then
|
||||
: # do nothing
|
||||
else
|
||||
display_alert "Command failed, retrying in ${sleep_seconds}s" "$*" "warn"
|
||||
fi
|
||||
unset RETRY_RUNS
|
||||
sleep ${sleep_seconds}
|
||||
done
|
||||
display_alert "Command failed ${counter} times, giving up" "$*" "warn"
|
||||
|
||||
Reference in New Issue
Block a user