Compare commits

..
2 Commits
Author SHA1 Message Date
Daniele Fucini ae33917e8a Make fwupdmgr hint conditional
Only show fwupmgr hint if firmware updates are available
Also fold that and git-monitor hint in a single notification
2026-10-04 08:56:47 +02:00
Daniele Fucini eabaa962dc Update PKGBUILD 2026-10-03 21:26:31 +02:00
2 changed files with 24 additions and 14 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
# Maintainer: Daniele Fucini <dfucini [at] gmail [dot] com>
pkgname=update-notify
pkgver=3.0.1
pkgver=3.0.2
pkgrel=1
pkgdesc='Notify when updates are available'
arch=('any')
@@ -15,7 +15,7 @@ makedepends=('git')
optdepends=('git-monitor: to check git repos for updates')
source=(git+${url}?signed#tag=${pkgver})
validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514')
sha256sums=('855659513d4a95be03c2fdc192c57b999a4d00eb2500282bd550285c2882b220')
sha256sums=('3541f7b27a48316ba6cf7acb243cb50ae024ff139a39837ab78cb0ec9007efcd')
package()
{
+22 -12
View File
@@ -98,20 +98,30 @@ done
# General updates threshold
# ---------------------------------------------------------------------------
if (( updates >= threshold )); then
notify_once "updates" "Updates available" "Arch: $arch_updates, AUR: $aur_updates"
reminders=()
hints=(
"git-monitor|Check git packages|Use git-monitor for git packages updates"
"fwupdmgr|Check firmware|Use fwupdmgr to check for firmware updates"
)
for hint in "${hints[@]}"; do
IFS='|' read -r cmd title body <<< "$hint"
if command -v "$cmd" >/dev/null 2>&1; then
notify_once "hint-$cmd" "$title" "$body"
# Always remind about git packages if git-monitor is installed
if command -v git-monitor >/dev/null 2>&1; then
reminders+=("git-monitor")
fi
# Firmware: only mention it when updates actually exist.
# 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 >/dev/null 2>&1
if (( $? == 0 )); then
reminders+=("fwupdmgr (firmware updates available)")
fi
done
fi
body="Arch: $arch_updates, AUR: $aur_updates"
if (( ${#reminders[@]} )); then
printf -v list '%s, ' "${reminders[@]}"
body+=$'\n'"Also check: ${list%, }"
fi
notify_once "updates" "Updates available" "$body"
else
clear_state "updates"
clear_state "hint-git-monitor"
clear_state "hint-fwupdmgr"
fi