OFFSET偏移
← All articlesOFFSET / FIELD NOTESNO. 063

informant: Arch news and Pacman hooks

Flag unread Arch news before installation or upgrade transactions, with separate entry points for reading and configuration.

English translation · Code and commands follow the Chinese original.

IN THESE READING PATHSArch Linux ↗
About 5 min readStart reading

Source and license: This article contains excerpts and adaptations of Bradford Smith's informant project documentation. Copyright (c) 2018-2024 Bradford Smith. The retained upstream material is provided under the MIT License (full copyright notice, permission notice, and disclaimer). This article changes the organization and some explanations, and adds guidance on usage limitations; this license notice was added on 2026-10-09. The license applies to the upstream material described above and does not change the ownership of rights to other content on this site.

Source and purpose#

This article is based on the project documentation for bradford-smith94/informant. The subcommands, hook behavior, and configuration format are retained below; consult the help and manual for your installed version for its exact behavior.

An Arch Linux News reader designed to also be used as a pacman hook. The project interrupts pacman transactions when unread news is detected rather than attempting an interactive prompt inside the hook.

Installation#

You can install from the project’s AUR package. In case anyone wants to use Github to create issues or contribute to the AUR package the author has also mirrored the PKGBUILD. Requirements are in requirements.txt. If you want to install it manually. NOTE: The provided pip requirements likely won't be as up to date as the Arch packages that AUR-installed informant will depend on, so your mileage may vary if you take this approach. On the first run informant assumes that you have not read any of the most recent news items. Use the informant read command specified below to mark items as read.

How does it work?#

informant provides 3 subcommands, 'check', 'list' and 'read'. informant check - will check for any unread news items, if there is only one unread item it will print it and mark it as read. Informant check will exit with return code equal to the number of unread news items (even if there is only one). This is the command used by the pacman hook, so that if there are unread news items it will interrupt your pacman transaction. informant list - will list the titles of the most recent news items (regardless of whether or not they have been read, unless the '--unread' option is given). There is also a '--reverse' option if you prefer to see them newest to oldest. informant read - if given a news item, will print that item and mark it as read. You can specify a news item as either an index or a string matching the title. If you want to use an index it must only be that shown when running informant list (without '--unread' or '--reverse'). If no item is given, will begin looping through all unread items, printing each one and marking them as read with a prompt to continue. Passing the '--all' flag will mark all items as read without printing them. More options can be found by reading informant --help or man informant.

About the pacman hook

informant provides a PreTransaction pacman hook, so that it can interrupt a pacman transaction if there are unread Arch Linux News items. This hook runs on Upgrades and Installs, but not Removes. If for some reason the hook (or informant) breaks in such a way that you cannot run a successful pacman transaction (even after trying to read the news) you should be able to pacman -Rsn informant. informant installs its hook to /usr/share/libalpm/hooks/ so you should also be able to override the pacman hook by placing a new hook in /etc/pacman.d/hooks/00-informant.hook or disable it by placing a symlink to /dev/null in that location (e.g. sudo ln -s /dev/null /etc/pacman.d/hooks/00-informant.hook, only after checking the destination does not already contain a custom override). More information on pacman hooks can be found in man alpm-hooks.

Configuration#

Informant can be configured to check multiple feeds instead of just the Arch Linux News feed (whether having it do so is actually useful or not is left up to the user). Informant will check for an informantrc.json file in a few places. It will check in this order:

  • CLI provided option
  • $HOME/.informantrc.json
  • $XDG_CONFIG_HOME/informantrc.json
  • /etc/informantrc.json
  • for each directory ($d) in $XDG_CONFIG_DIRS it will look for $d/informantrc.json

NOTE: If you want the configuration file to be used in the pacman hook make sure to use a save location that will be accessible to informant when running as root/sudo.

Configuration Syntax

The syntax of informantrc.json is a JSON object containing one key (feeds) that is a list describing the feeds you want informant to check. Each feed is represented as a JSON object with the following keys:

  • name (optional) - used to show which feed each news item is from
  • url (required) - the feed URL
  • title-key (optional) - defaults to title, the key used to reference the news item title in the feed
  • body-key (optional) - defaults to summary, the key used to reference the news item body in the feed
  • timestamp-key (optional) - defaults to published, the key used to reference the news item date in the feed

An example is provided here as informanrc.json.example which configures informant to check the Arch Linux News feed as well as the Arch Linux 32 News feed.

Usage limitations#

read --all only changes the read status; it does not establish that you have completed the manual intervention required by a news item. You still need to read Arch News yourself after temporarily disabling the hook. The program runs in pacman's permission context, so system-wide configuration must be readable in that context. Do not put private feed credentials in a public article.

References & further reading

  1. bradford-smith94/informant original project ↗
  2. AUR: informant ↗
  3. alpm-hooks(5) ↗
  4. informant: full MIT copyright and license notice ↗
  5. Upstream MIT License ↗

Adapted from technical notes. Examples use generic names.

Continue along a reading path

Arch Linux

  1. 01Arch Linux philosophy and installation planning
  2. 02Kernel management, systemd-boot, and UKIs
  3. 03Pacman hooks, the AUR, and build security
  4. 04Btrfs subvolume layouts and Snapper snapshots
  5. 05Hardening with LUKS2, Secure Boot, and TPM2
  6. 06Performance choices and an everyday maintenance checklist
  7. 07Common Pacman commands and how to remember their flags
  8. 08Diagnosing slow Pacman downloads and choosing mirrors
  9. 09informant: Arch news and Pacman hooks
  10. 10Arch Linux with Btrfs: manual installation and archinstall
  11. 11Configuring GNOME, input methods, and snapshots
  12. 12GNOME laptop management and desktop customization
  13. 13KVM, GPU passthrough, and gaming on Arch Linux
  14. 14Swap, kernels, and troubleshooting on an Arch desktop
CONTINUE READING / NEXT ARTICLEArch Linux with Btrfs: manual installation and archinstall

Work through UEFI, Btrfs subvolumes, the base system, GRUB, and the archinstall installation process.