GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
ALPM-HOOKS(5) Pacman Manual ALPM-HOOKS(5)

alpm-hooks - alpm hook file format

[Trigger] (Required, Repeatable)
Operation = Install|Upgrade|Remove (Required, Repeatable)
Type = File|Package (Required)
Target = <Path|PkgName> (Required, Repeatable)
[Action] (Required)
Description = ... (Optional)
When = PreTransaction|PostTransaction (Required)
Exec = <Command> (Required)
Depends = <PkgName> (Optional)
AbortOnFail (Optional, PreTransaction only)
NeedsTargets (Optional)

libalpm provides the ability to specify hooks to run before or after transactions based on the packages and/or files being modified. Hooks consist of a single [Action] section describing the action to be run and one or more [Trigger] section describing which transactions it should be run for.

Hooks are read from files located in the system hook directory /usr/share/libalpm/hooks, and additional custom directories specified in pacman.conf(5) (the default is /etc/pacman.d/hooks). The file names are required to have the suffix ".hook". Hooks are run in alphabetical order of their file name, where the ordering ignores the suffix.

Hooks must contain at least one [Trigger] section that determines which transactions will cause the hook to run. If multiple trigger sections are defined the hook will run if the transaction matches any of the triggers.

Operation = Install|Upgrade|Remove

Select the type of operation to match targets against. May be specified multiple times. Installations are considered an upgrade if the package or file is already present on the system regardless of whether the new package version is actually greater than the currently installed version. For File triggers, this is true even if the file changes ownership from one package to another. Required.

Type = File|Package

Select whether targets are matched against transaction packages or files. See CAVEATS for special notes regarding File triggers. Required.

Target = <path|package>

The file path or package name to match against the active transaction. File paths refer to the files in the package archive; the installation root should not be included in the path. Shell-style glob patterns are allowed. It is possible to invert matches by prepending a file with an exclamation mark. May be specified multiple times. Required.

Description = ...
An optional description that describes the action being taken by the hook for use in front-end output.

Exec = <command>

Command to run. Command arguments are split on whitespace. Values containing whitespace should be enclosed in quotes. Required.

When = PreTransaction|PostTransaction

When to run the hook. Required.

Depends = <package>

Packages that must be installed for the hook to run. May be specified multiple times.

AbortOnFail

Causes the transaction to be aborted if the hook exits non-zero. Only applies to PreTransaction hooks.

NeedsTargets

Causes the list of matched trigger targets to be passed to the running hook on stdin.

Hooks may be overridden by placing a file with the same name in a higher priority hook directory. Hooks may be disabled by overriding them with a symlink to /dev/null.

# Force disks to sync to reduce the risk of data corruption
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package
Target = *
[Action]
Depends = coreutils
When = PostTransaction
Exec = /usr/bin/sync

There are situations when file triggers may act in unexpected ways. Hooks are triggered using the file list of the installed, upgraded, or removed package. When installing or upgrading a file that is extracted with a .pacnew extension, the original file name is used in triggering the hook. When removing a package, all files owned by that package can trigger a hook whether or not they were actually present on the file system before package removal.

PostTransaction hooks will not run if the transaction fails to complete for any reason.

See the pacman website at https://www.archlinux.org/pacman/ for current information on pacman and its related tools.

Bugs? You must be kidding; there are no bugs in this software. But if we happen to be wrong, send us an email with as much detail as possible to pacman-dev@archlinux.org.

Current maintainers:

•Allan McRae <allan@archlinux.org>

•Andrew Gregory <andrew.gregory.8@gmail.com>

•Dan McGee <dan@archlinux.org>

•Dave Reisner <dreisner@archlinux.org>

Past major contributors:

•Judd Vinet <jvinet@zeroflux.org>

•Aurelien Foret <aurelien@archlinux.org>

•Aaron Griffin <aaron@archlinux.org>

•Xavier Chantry <shiningxc@gmail.com>

•Nagy Gabor <ngaba@bibl.u-szeged.hu>

For additional contributors, use git shortlog -s on the pacman.git repository.

2019-03-01 Pacman 5.1.3

Search for    or go to Top of page |  Section 5 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.