Files
update-notify/README.md
T

4.3 KiB

update-notify

Desktop notifications for pending updates on Arch Linux.

update-notify runs on a systemd user timer and checks:

  • Repo updates, using checkupdates from pacman-contrib.
  • AUR updates for packages in a local aurutils repository (aur repo -u).
  • Custom kernel rebuilds: when a stock kernel (e.g. linux-lts) has a newer version than your custom build of it (e.g. linux-lts-custom).

It sends one notification, and only when its content changes since the last one:

  • Update counts are shown once the total number of updates reaches a threshold (default 30). Reminders for git-monitor and pending firmware updates (fwupdmgr) are added when those tools are installed, and one to run trustsight before building pending AUR updates.
  • Kernel rebuild reminders are always shown, even below the threshold.

Requirements

  • pacman-contrib
  • libnotify and a running notification daemon

Optional:

  • aurutils: check AUR packages in the local repository
  • fwupd: check for firmware updates
  • git-monitor: remind to check git packages
  • trustsight: remind to vet AUR updates before building them

Installation

Build and install the package with the included PKGBUILD:

makepkg -si

Or, with aurutils, build it into your local repository with aur build and install it with pacman.

Then enable the timer:

systemctl --user enable --now update-notify.timer

The timer runs 5 minutes after boot, then every 6 hours.

A pacman hook also runs update-notify after every pacman transaction, for each logged-in user whose timer is active, so the notification and the status bar file are current right after an upgrade.

Refresh after building packages

Building into a local repository (aur build, aur sync) doesn't run pacman, so the hook can't catch it. To run update-notify whenever a repository changes, add the repository files to watch to update-notify.path:

systemctl --user edit update-notify.path
[Path]
PathChanged=/home/aur-local/aur-local.db.tar.gz.sig
PathChanged=/home/custom-pkgs/custom-pkgs.db.tar.gz.sig

Watch the .db.tar.gz.sig file for signed repositories, or .db.tar.gz for unsigned ones (.db is a symlink). Then enable it:

systemctl --user enable --now update-notify.path

Usage

update-notify [threshold]

threshold is the minimum number of updates (repo + AUR) before update counts are shown. It overrides the THRESHOLD setting below.

Configuration

Settings are read from $XDG_CONFIG_HOME/update-notify/config (default ~/.config/update-notify/config), a bash file that is sourced by the script. All settings are optional:

  • THRESHOLD: minimum number of updates before update counts are shown (default 30).
  • AUR_REPO: name of the local aurutils repository (default aur-local).
  • KERNELS: maps each stock kernel package to its custom build (default: linux, linux-lts and linux-zen to <name>-custom). Kernels where either package isn't installed are skipped. Set KERNELS=() to disable the kernel check.

A commented sample config is installed with the package. To start from it:

mkdir -p ~/.config/update-notify
cp /usr/share/doc/update-notify/config.example ~/.config/update-notify/config

Kernel versions are compared without pkgrel, so a stock packaging-only update doesn't trigger a rebuild reminder. A custom build already in the local repository but not installed yet counts as up to date.

The content of the last notification is stored in $XDG_STATE_HOME/update-notify (default ~/.local/state/update-notify). Delete it to get the current notification again.

Status bars

Each run also writes the pending updates to $XDG_STATE_HOME/update-notify/pending, whether or not the threshold is reached, for status bars such as xmobar to read:

threshold 30
repo <pkg> <newver>
aur <pkg> <newver>
kernel <custom-pkg> <stock-ver>

The file reflects the last run, which the pacman hook and update-notify.path keep close to current. To keep a bar current in between, drop entries whose installed version (pacman -Q) is no longer older than newver, or, for kernel lines, whose custom build has caught up with stock-ver (ignoring pkgrel). This only reads local data, so it's cheap to run often.

License

GPL-3.0-or-later. See LICENSE.