From c787b8dd136b69e2c6439872e1a831e93a1180de Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 22 Sep 2025 07:21:26 +0200 Subject: [PATCH] feat: Show delay progress (#306) Added a delay function to handle retry messages for failed downloads. --- src/install.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/install.sh b/src/install.sh index 75a8ae5..24366c8 100644 --- a/src/install.sh +++ b/src/install.sh @@ -28,6 +28,21 @@ function getRandom() { return 0 } +delay() { + + local i + local delay="$1" + local msg="Retrying failed download in X seconds..." + + for i in $(seq $delay -1 1); do + info "${msg/X/$i}" + html "${msg/X/$i}" + sleep 1 + done + + return 0 +} + function download() { local info="" local dest="$1" @@ -150,8 +165,7 @@ install() { local file="$STORAGE/boot.dmg" if ! download "$file" "$board" "$version"; then - info "Retrying failed download in 5 seconds..." - sleep 5 + delay 5 if ! download "$file" "$board" "$version"; then rm -f "$file" exit 60