This page is locked. All discussion to the pacman-dev mailing list. The discussion page will be ignored...
We will one day live in a world where we no longer have to suffer the tedium of repeated tasks in pacman install files. The future will arrive bearing the stuff of legends... Things that have been talked about in quiet whispers for decades. Pacman hooks!
Hook files are placed in /usr/lib/pacman/hooks or /etc/pacman.d/hooks. Those in /etc override those in /usr/lib. An empty file in /etc disables the hook in /usr/lib.
All hooks filenames must end in .hook (to avoid issues with e.g. .pacsaves)
[Hook] Description = Add info files to the info directory Requires = install-info Type = PostTransaction [Target] File = /usr/share/info/* Exec = install-info %f usr/share/info/dir &>/dev/null
Description: (Optional) Brief description of the hook
Requires: (Optional) Required software for hook to run
- Before the installation/upgrade of the package (PreInstall)
- After the installation/upgrade of the package (PostInstall)
- Before the removal of the package (PreRemove)
- After the removal of the package (PostRemove)
- At the end of the transaction (PostTransaction)
(TODO: sort out definite list - leaning on side of generality)
Before/After: (Optional) Control the ordering of the hook
File: File or list of files that trigger a hook. Can be increase in specificity by using the prefixes Installed/Upgraded/Removed
Package: Package or list of packages that trigger the hook. Installed/Upgraded/Removed prefixes
(TODO: other general targets - e.g. for all transactions, all installs?)
Exec: the command to be run during the upgrade. Can use the following replacements (will be quoted):
%f: the triggering file - if more than one, the command is looped %F: the list of triggering files %p: the triggering package %P: the list of triggering packages
One additional option HooksDir = /etc/pacman.d/hooks
(TODO: how would this work with the /usr/lib and /etc dichotomy)