Part of the Arch Linux system maintenance is to actively read
latest news. Mostly anyone who uses Arch has
come across this piece of advice: read the news before updating! In other
words, before running the dreaded
sudo pacman -Syu command, one should be
prepared to act upon any breaking changes by making sure to read about them
The sad reality is that people are lazy. I am lazy. Either I forget to read the news, or I blatantly ignore them, so I have a false right to brag about the damage that has been don to me on my social networks. Well, maybe network, I only publish posts in the Fediverse right now. I wish the system would tell me to read the news before the installation.
Of course, there is a way to do this automatically. Arch Linux package
pacman offers a piece of functionality called
hooks. I have written
about hooks previously when
streamlining yadm or
hacking on Cypress and
automating calendar (I
do not use that anymore). All these were git hooks.
Pacman however is using a different kind of hook, an alpm hook. The abbreviation stands for Arch Linux Package Management. Although the documentation looks very solid, I must admit that this is exactly the type of thing I do not want to study. From my understanding, I could probably use it only for exactly this one use case - preventing pacman updating the system before reading the fresh news. Unless I became an Arch contributor or a maintainer or something similar. Wish someone did this already.
Fortunately, someone already made this working. A pacman hook that prevents updating, unless user confirmed he read the news. It's called Informant. I am quite surprised I did not find about it sooner, the system maintenance page about Reading before upgrading the system has been mentioning it since November 2019. It probably shows something about how little I cared about that specific paragraph. Better late than never.
Informant is exactly a piece of technology that automates the whole workflow, saving time and cognitive capacity in the process, which should somehow be the point of automation I believe. The details about the usage are described in the project's README. After installing manually or via AUR there is just an initial read command and after that is basically set it and forget. Very convenient.
Hooks are in fact usually quite simple in their nature and maybe I am scared of them only because of the fear of the unknown. I mean, I have learned to use git hooks already, and they feel simple now. Curiosity made me look at the alpm hook behind Informant.
[Trigger] Operation = Install Operation = Upgrade Type = Package Target = * [Action] Description = Checking Arch News with Informant ... When = PreTransaction Exec = /usr/bin/informant check AbortOnFail
Looking at the hook from this perspective it does not look so mysterious
after all, just a small digestible, self-explanatory pieces. Of course, by
digging deeper, the
/usr/bin/informant is actually a Python script doing
the fetching and keeping track of already read news, among other things.
But now that I see the pacman hooks aren't actually that scary, I might
find myself automating something regarding the packages management. Would
definitely love to hear some nice ideas!
This is a 26th post of #100daystooffload.