1ALPM-HOOKS(5) Pacman Manual ALPM-HOOKS(5)
2
3
4
6 alpm-hooks - alpm hook file format
7
9 [Trigger] (Required, Repeatable)
10 Operation = Install|Upgrade|Remove (Required, Repeatable)
11 Type = Path|Package (Required)
12 Target = <Path|PkgName> (Required, Repeatable)
13
14 [Action] (Required)
15 Description = ... (Optional)
16 When = PreTransaction|PostTransaction (Required)
17 Exec = <Command> (Required)
18 Depends = <PkgName> (Optional)
19 AbortOnFail (Optional, PreTransaction only)
20 NeedsTargets (Optional)
21
23 libalpm provides the ability to specify hooks to run before or after
24 transactions based on the packages and/or files being modified. Hooks
25 consist of a single [Action] section describing the action to be run
26 and one or more [Trigger] section describing which transactions it
27 should be run for.
28
29 Hooks are read from files located in the system hook directory
30 /usr/share/libalpm/hooks, and additional custom directories specified
31 in pacman.conf(5) (the default is /etc/pacman.d/hooks). The file names
32 are required to have the suffix ".hook". Hooks are run in alphabetical
33 order of their file name, where the ordering ignores the suffix.
34
36 Hooks must contain at least one [Trigger] section that determines which
37 transactions will cause the hook to run. If multiple trigger sections
38 are defined the hook will run if the transaction matches any of the
39 triggers.
40
41 Operation = Install|Upgrade|Remove
42 Select the type of operation to match targets against. May be
43 specified multiple times. Installations are considered an upgrade
44 if the package or file is already present on the system regardless
45 of whether the new package version is actually greater than the
46 currently installed version. For Path triggers, this is true even
47 if the file changes ownership from one package to another.
48 Required.
49
50 Type = Path|Package
51 Select whether targets are matched against transaction packages or
52 files. See CAVEATS for special notes regarding Path triggers. File
53 is a deprecated alias for Path and will be removed in a future
54 release. Required.
55
56 Target = <path|package>
57 The path or package name to match against the active transaction.
58 Paths refer to the files in the package archive; the installation
59 root should not be included in the path. Shell-style glob patterns
60 are allowed. It is possible to invert matches by prepending a
61 target with an exclamation mark. May be specified multiple times.
62 Required.
63
65 Description = ...
66 An optional description that describes the action being taken by
67 the hook for use in front-end output.
68
69 Exec = <command>
70 Command to run. Command arguments are split on whitespace. Values
71 containing whitespace should be enclosed in quotes. Required.
72
73 When = PreTransaction|PostTransaction
74 When to run the hook. Required.
75
76 Depends = <package>
77 Packages that must be installed for the hook to run. May be
78 specified multiple times.
79
80 AbortOnFail
81 Causes the transaction to be aborted if the hook exits non-zero.
82 Only applies to PreTransaction hooks.
83
84 NeedsTargets
85 Causes the list of matched trigger targets to be passed to the
86 running hook on stdin.
87
89 Hooks may be overridden by placing a file with the same name in a
90 higher priority hook directory. Hooks may be disabled by overriding
91 them with a symlink to /dev/null.
92
94 # Force disks to sync to reduce the risk of data corruption
95
96 [Trigger]
97 Operation = Install
98 Operation = Upgrade
99 Operation = Remove
100 Type = Package
101 Target = *
102
103 [Action]
104 Depends = coreutils
105 When = PostTransaction
106 Exec = /usr/bin/sync
107
109 There are situations when path triggers may act in unexpected ways.
110 Hooks are triggered using the file list of the installed, upgraded, or
111 removed package. When installing or upgrading a file that is extracted
112 with a .pacnew extension, the original file name is used in triggering
113 the hook. When removing a package, all files owned by that package can
114 trigger a hook whether or not they were actually present on the file
115 system before package removal.
116
117 PostTransaction hooks will not run if the transaction fails to complete
118 for any reason.
119
120 See the pacman website at https://www.archlinux.org/pacman/ for current
121 information on pacman and its related tools.
122
124 Bugs? You must be kidding; there are no bugs in this software. But if
125 we happen to be wrong, submit a bug report with as much detail as
126 possible at the Arch Linux Bug Tracker in the Pacman section.
127
129 Current maintainers:
130
131 · Allan McRae <allan@archlinux.org>
132
133 · Andrew Gregory <andrew.gregory.8@gmail.com>
134
135 · Dan McGee <dan@archlinux.org>
136
137 · Dave Reisner <dreisner@archlinux.org>
138
139 Past major contributors:
140
141 · Judd Vinet <jvinet@zeroflux.org>
142
143 · Aurelien Foret <aurelien@archlinux.org>
144
145 · Aaron Griffin <aaron@archlinux.org>
146
147 · Xavier Chantry <shiningxc@gmail.com>
148
149 · Nagy Gabor <ngaba@bibl.u-szeged.hu>
150
151 For additional contributors, use git shortlog -s on the pacman.git
152 repository.
153
154
155
156Pacman 5.2.1 2020-04-01 ALPM-HOOKS(5)