Informant is an Arch Linux News reader designed to also be used as a pacman hook. When installed and configured as a pacman hook, Informant automatically retrieves the latest news from the Arch Linux website and displays it during system updates or package installations. This ensures that users are informed about any critical information that may affect their system or require specific actions.
How Informant Works?
The informant utility offers three subcommands: "check," "list," and "read." These subcommands serve different purposes and provide specific functionality.
informant check- When you execute the "
informant check" command, it performs a check for any unread news items. If there is only one unread item, it will print the content of that item and mark it as read. The "
informant check" command's exit code is equal to the number of unread news items, even if there is only one. This command is utilized by the pacman hook, which means that if there are any unread news items, it will interrupt your pacman transaction to ensure that you are aware of the news before proceeding.
informant list- The "
informant list" command allows you to list the titles of the most recent news items. By default, it displays titles regardless of whether they have been read or not, unless the '
--unread' option is specified. Additionally, the command offers a '
--reverse' option that allows you to view the news items from newest to oldest.
- informant read - The "
informant read" command allows you to view and mark news items as read. You can specify a specific item, loop through unread items, or mark all items as read depending on your needs. This command works as follows:
- If you provide a news item, it will print that item and mark it as read. You can specify the news item using either its index or by matching its title with a string.
- When using an index, make sure to choose an index that is displayed when running "
informant list" without the "
--unread" or "
- If no news item is provided, the command will start going through all the unread items one by one. It will print each item, mark it as read, and prompt you to continue to the next item.
- By using the "
--all" flag, you can mark all the unread items as read without printing their content.
About Informant Pacman Hook
The Informant utility includes a PreTransaction pacman hook that is designed to interrupt a pacman transaction if there are any unread Arch Linux News items. This hook specifically runs during upgrades and installations but not during removals.
When you install Informant, its hook is installed in the directory
/usr/share/libalpm/hooks/. This means that you have the flexibility to override the default pacman hook behavior by placing a new hook in the directory
/etc/pacman.d/hooks/ with the name
00-informant.hook. By doing so, you can customize or modify the hook's functionality according to your specific needs.
Install Informant in Arch Linux
$ paru -S informant
$ yay -S informant
Once installed, you can configure Informant as a pacman hook by editing the
file. This file is automatically created by default. If it doesn't exist for any reason, you can create the file and add the following contents:
[Trigger] Operation = Install Operation = Upgrade Type = Package Target = * Target = !informant [Action] Description = Checking Arch News with Informant ... When = PreTransaction Exec = /usr/bin/informant check AbortOnFail
Let us break down the above code and see what each option does.
[Trigger] section, the code defines the conditions under which the hook should be triggered. In this case, the hook will be triggered for two operations: "Install" and "Upgrade".
Type = Package indicates that the hook applies to package-related operations. The
Target = * specifies that the hook applies to any package. However,
Target = !informant excludes the package named "informant" from triggering the hook. This means the hook won't be executed when installing or upgrading the "informant" package itself.
[Action] section, the code specifies the action to be performed when the hook is triggered. The Description field provides a brief description of the action, which in this case is "Checking Arch News with Informant …".
When = PreTransaction indicates that the action should take place before the transaction is executed. In other words, it runs as a pre-action before the package installation or upgrade occurs.
Exec = /usr/bin/informant check line specifies the command to be executed. It runs the command
/usr/bin/informant check, which checks for Arch News using the "informant" utility.
AbortOnFail is a directive that ensures that if the "
informant check" command fails, it will abort the transaction. This helps ensure that any important news or updates are addressed before proceeding with the package installation or upgrade.
In summary, with this configuration, the pacman hook will be triggered during package installation or upgrade operations. It specifies that the hook should not be executed when the target package is "informant" itself. The hook action involves running the command
/usr/bin/informant check to check for Arch News using the "informant" utility. The AbortOnFail directive ensures that if the check fails, it will interrupt the transaction.
How to Use Informant?
As stated already, when you try to update or install any package, the informant will interrupt the pacman transaction if there are any unread news. Have a look at the following output. I tried to update my Arch Linux using '
pacman -Syyu' command. The informant tool interrupted the transaction and displayed there are 10 unread messages left and suggested me to read them before running any further pacman transactions.
[..] :: Running pre-transaction hooks... (1/1) Checking Arch News with Informant ... There are 10 unread news items! Use informant to read them. :: informant: Run `informant read` before re-running your pacman command error: command failed to execute correctly error: failed to commit transaction (failed to run transaction hooks) Errors occurred, no packages were upgraded.
To read the Arch Linux news using Informant, simply run:
$ informant read
This will list all unread commands. You will be prompted to go the next message after reading each one. Simply press 'y' to read next item.
After reading all items, simply re-run the pacman command. This time it will run without any interruption.
As you see in the above output, there is a permission denied error message:
ERROR: Unable to read cache information: [Errno 13] Permission denied: '/var/cache/informant/6/c/0/1/e/6c01e271562517b0f36f92a0135827dfdab1ed9faf33b98f5b8338e2'
To get rid of this error, either run all commands prefixed with
sudo or add your current user to group "informant" to avoid the need for
$ sudo usermod -aG informant ostechnix
ostechnix with your actual username.
Informant Command Examples
Here are a few examples of how you can use the "informant" command:
1. Checking for Unread News:
$ informant check
This command checks for any unread news items. If there are unread items, it displays them in the terminal.
2. Listing News Titles:
$ informant list
This command lists the titles of the most recent news items, regardless of whether they have been read or not.
3. Reading a Specific News Item:
$ informant read 3
This command reads the news item with index 3. You can replace
3 with the specific index or title of the news item you want to read.
4. Looping through Unread News Items:
$ informant read
Running this command without specifying a news item will begin a loop, where each unread news item is displayed one by one. You will be prompted to continue to the next item after reading each one.
5. Marking All Items as Read:
$ informant read --all
This command marks all unread news items as read without printing their content.
These examples demonstrate how you can utilize different subcommands and options provided by the "informant" command to check, list, read, and manage Arch Linux News items according to your needs.
Disable Informant Hook
If you wish to disable the "informant" hook entirely, you can create a symlink to
/dev/null in the
/etc/pacman.d/hooks/ directory. For example, you can use the following command to create the symlink:
$ ln -s /dev/null /etc/pacman.d/hooks/00-informant.hook
Replace the path of the hook file with your own. This effectively redirects the hook to
/dev/null, which essentially discards its output and disables its functionality.
For more detailed information and guidance on pacman hooks, including their usage and configuration, you can refer to the manual page by running the following command:
$ man alpm-hooks
If the hook or the "informant" utility breaks and prevents you from completing a successful pacman transaction, even after attempting to read the news, you can resolve the issue by removing the "informant" package from your system.
To remove informant, just run:
$ sudo pacman -Rsn informant
Frequently Asked Questions
Here's a FAQ (Frequently Asked Questions) for the Informant utility:
Informant is a command-line utility designed for Arch Linux users to conveniently read and manage Arch Linux News.
Informant utilizes the Arch Linux News RSS feed to retrieve and present news items in a readable format within the terminal.
Informant can be installed from the Arch User Repository (AUR) using AUR helpers like Paru or Yay. For example, you can run
paru -S informant or
yay -S informant to install it.
Informant provides subcommands such as '
check' to check for unread news items, '
list' to list the titles of recent news items, and '
read' to read specific news items or loop through unread items.
You can run
informant check to check for any unread news items. It will display the content of the item if there is only one unread item, marking it as read.
Yes, you can use
informant list to list the titles of the most recent news items, regardless of their read status. Add the
--unread option to restrict the list to unread items only.
You can run
informant read <index_or_title> to read a specific news item. Specify the item using its index (shown in '
informant list' output) or by matching its title.
Yes, you can use
informant read --all to mark all unread news items as read without printing their content.
Informant provides options such as
--reverse to list news items in reverse order and
--unread to focus on unread items. Use
informant --help to explore additional options.
You can uninstall Informant using your package manager. For example, run
pacman -Rsn informant to remove the Informant package from your system.
If you have any additional questions or need further assistance with Informant, feel free to consult the documentation or post your questions via the comment section below.
Informant is a utility that provides notifications and displays news from the Arch Linux website whenever there are important announcements, updates, or issues related to the Arch Linux distribution. With the help of Informant, the Arch users can stay up to date with the latest news, announcements, and important information related to the Arch Linux distribution.