From a72fd1639ebace887c57234e7d1e9f336e211ac2 Mon Sep 17 00:00:00 2001 From: Daniele Fucini Date: Wed, 7 Oct 2026 19:45:47 +0200 Subject: [PATCH] Accept zero-padded threshold, simplify fwupdmgr check --- update-notify | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update-notify b/update-notify index 851e62b..ed7a8b6 100755 --- a/update-notify +++ b/update-notify @@ -15,6 +15,7 @@ declare -A KERNELS=( state_dir="${XDG_STATE_HOME:-$HOME/.local/state}/update-notify" [[ $threshold =~ ^[0-9]+$ ]] || { echo "Threshold must be a number" >&2; exit 1; } +threshold=$((10#$threshold)) # force base 10, so e.g. "08" isn't read as octal mkdir -p "$state_dir" # notify-send from cron/systemd needs the session bus address @@ -137,8 +138,7 @@ if (( over_threshold )); then # fwupdmgr get-updates exits 0 when updates are available, 2 when there are none. # --no-metadata-check avoids prompting/refreshing; the fwupd-refresh timer keeps metadata fresh. if command -v fwupdmgr >/dev/null 2>&1; then - timeout 30 fwupdmgr get-updates --no-metadata-check /dev/null 2>&1 - if (( $? == 0 )); then + if timeout 30 fwupdmgr get-updates --no-metadata-check /dev/null 2>&1; then reminders+=("fwupdmgr (firmware updates available)") fi fi