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