Difference between revisions of "User:Allan/Pacman Hooks"
(→[Hook] section) |
Falconindy (talk | contribs) (→Hooks) |
||
Line 6: | Line 6: | ||
=Hooks= | =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. | + | 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 or a symlink to /dev/null disables the hook in /usr/lib. |
Hook files require the .hook suffix. | Hook files require the .hook suffix. |
Revision as of 02:02, 8 July 2013
Contents
NOTE
This page is locked. All discussion to the pacman-dev mailing list. The discussion page will be ignored...
The Dream
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!
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 or a symlink to /dev/null disables the hook in /usr/lib.
Hook files require the .hook suffix.
Hook Format
Example:
[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
Detailed options
[Hook] section
Description: (Optional) Brief description of the hook
Requires: (Optional) Required software for hook to run
Type: PreRemove|PostRemove|PreInstall|PostInstall|PreTransaction|PostTransaction
- 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 beginning of the transaction (PreTransaction)
- At the end of the transaction (PostTransaction)
Before/After: (Optional) Control the ordering of the hook
(TODO: Use lexical ordering of files rather than this?)
[Target] Section
File: File or list of files that trigger a hook.
or
Package: Package or list of packages that trigger the hook.
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 triggers, the command is looped %F: the list of triggering files %p: the triggering package - if more than one triggers, the command is looped %P: the list of triggering packages
(TODO: issues with maximum command line length)
Additional Configuration
During ./configure the system hooks directory is specified with --with-hooksdir defaulting to EPREFIX/lib when unspecified. The override directory is not configurable beyond using --sysconfdir.
Implementation Notes
- File hooks are still run when install scriptlets are run and not directly after the file.
- New hooks need to be detected and activate on install.