From dbb7a1766d6b9068627e910d1753e95d15e9d507 Mon Sep 17 00:00:00 2001 From: Daniele Fucini Date: Wed, 7 Oct 2026 19:45:38 +0200 Subject: [PATCH] Avoid lost and repeated notifications Exit without touching the state when checkupdates fails, so a transient error no longer clears it and causes the same notification on the next run. Also save the state only after notify-send succeeds, so a failed notification is retried. --- update-notify | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/update-notify b/update-notify index 9757319..842d93e 100755 --- a/update-notify +++ b/update-notify @@ -31,8 +31,7 @@ notify_once() { if [[ -f $file && $(<"$file") == "$body" ]]; then return 0 fi - printf '%s' "$body" > "$file" - notify-send "$title" "$body" + notify-send "$title" "$body" && printf '%s' "$body" > "$file" } # Forget a key so the next occurrence notifies again. @@ -75,7 +74,9 @@ latest_version() { checkupdates_out=$(checkupdates 2>/dev/null) checkupdates_rc=$? if (( checkupdates_rc == 1 )); then + # Bail out without touching the state, so the next good run doesn't re-notify echo "checkupdates failed (network or sync problem?)" >&2 + exit 1 fi arch_list=()