johnramsden/zectl

Pacman hook

schmitmd opened this issue · 1 comments

Hey there, just wanted to share something that might be cool to toss in the documentation. Manually creating boot envs every time I upgrade my kernel was something difficult to remember whenever running pacman on Arch, so I wrote a little hook to make one for me on each upgrade. It's not perfect, but might be helpful to someone besides me.

Uncomment the "HookDir" config directive in /etc/pacman.conf, then make a /etc/pacman.d/hooks/10-zectl.hook file. Put the following in it:

[Trigger]
Type = Package
Operation = Install
Operation = Upgrade
Target = linux linux-lts

[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = usr/lib/modules/*/vmlinuz

[Action]
Description = Creating Boot Environment...
When = PreTransaction
Exec = /etc/pacman.d/scripts/zectl_create

and make a /etc/pacman.d/scripts/zectl_create script with something simple like:

#!/bin/bash
/usr/sbin/zectl create $(uname -r)