Difference between revisions of "User:Allan/Pacman Hooks - Version 2"
Latest revision as of 11:43, 5 July 2013
This is a new draft, look at the old propsal for previous discussions.
Short Version: Pacman should have hooks to perform common tasks.
Long Version: Many packages have install files that perform a common task; e.g. adding/removing info files in the info directory file, installing/uninstalling gconf schemas, updating the font/desktop/icon cache. It would be good if pacman was extendible through a hooks mechanism so that these could be handled automatically.
Each hook would have a "trigger" file. This file should be in a well-known config file format, preferably an ini-file. For avoiding conflicts with
.pacsave files, all trigger files should end with
.trigger. These triggers can be either put int
/etc/pacman.d/hooks/triggers/. Similar to udev or systemd, a file in
/etc/pacman.d/hooks/triggers/ will override a file in
/usr/lib/pacman/hooks/triggers/ of the same name - an empty file will disable the trigger.
All hook triggers are read at the beginning of the transaction.
If a new trigger is added during the transaction, it is parsed and added, and will be valid for the current and all subsequent packages. Applicability to the current package may be limited, in particular, PreInstall triggers will not work in this case.
Triggers can be triggered using any of the following criteria:
- The package name of an installed/upgraded package matches a given pattern.
- An installed/changed file matches a given pattern.
The package name or file name can be used as arguments in the following action.
Action execution can take place:
- 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 (Transaction)
.trigger file contains an
Action= statement. If the argument is an absolute path, the executable at that path is executed. Otherwise, the executable
/etc/pacman.d/hooks/actions/$arg is executed. If that doesn't exist,
/usr/lib/pacman/hooks/actions/$arg is executed.