summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man5/alpm-hooks.5
blob: f82c1e8a224156bae5f9f0704cb1f7d09bcb7549 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
'\" t
.\"     Title: alpm-hooks
.\"    Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 2024-01-25
.\"    Manual: Pacman Manual
.\"    Source: Pacman 6.0.2
.\"  Language: English
.\"
.TH "ALPM\-HOOKS" "5" "2024\-01\-25" "Pacman 6\&.0\&.2" "Pacman Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
alpm-hooks \- alpm hook file format
.SH "SYNOPSIS"
.sp
.nf
[Trigger] (Required, Repeatable)
Operation = Install|Upgrade|Remove (Required, Repeatable)
Type = Path|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)
.fi
.SH "DESCRIPTION"
.sp
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 \fI[Action]\fR section describing the action to be run and one or more \fI[Trigger]\fR section describing which transactions it should be run for\&.
.sp
Hooks are read from files located in the system hook directory /usr/share/libalpm/hooks, and additional custom directories specified in \fBpacman.conf\fR(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\&.
.SH "TRIGGERS"
.sp
Hooks must contain at least one \fI[Trigger]\fR 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 \fBany\fR of the triggers\&.
.PP
\fBOperation =\fR Install|Upgrade|Remove
.RS 4
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 Path triggers, this is true even if the file changes ownership from one package to another\&. Required\&.
.RE
.PP
\fBType =\fR Path|Package
.RS 4
Select whether targets are matched against transaction packages or files\&. See CAVEATS for special notes regarding Path triggers\&.
\fIFile\fR
is a deprecated alias for
\fIPath\fR
and will be removed in a future release\&. Required\&.
.RE
.PP
\fBTarget =\fR <path|package>
.RS 4
The path or package name to match against the active transaction\&. Paths refer to the files in the package archive; the installation root should
\fBnot\fR
be included in the path\&. Shell\-style glob patterns are allowed\&. It is possible to invert matches by prepending a target with an exclamation mark\&. May be specified multiple times\&. Required\&.
.RE
.SH "ACTIONS"
.PP
\fBDescription =\fR \&...
.RS 4
An optional description that describes the action being taken by the hook for use in front\-end output\&.
.RE
.PP
\fBExec =\fR <command>
.RS 4
Command to run\&. Command arguments are split on whitespace\&. Values containing whitespace should be enclosed in quotes\&. Required\&.
.RE
.PP
\fBWhen =\fR PreTransaction|PostTransaction
.RS 4
When to run the hook\&. Required\&.
.RE
.PP
\fBDepends =\fR <package>
.RS 4
Packages that must be installed for the hook to run\&. May be specified multiple times\&.
.RE
.PP
\fBAbortOnFail\fR
.RS 4
Causes the transaction to be aborted if the hook exits non\-zero\&. Only applies to PreTransaction hooks\&.
.RE
.PP
\fBNeedsTargets\fR
.RS 4
Causes the list of matched trigger targets to be passed to the running hook on
\fIstdin\fR\&.
.RE
.SH "OVERRIDING HOOKS"
.sp
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 \fI/dev/null\fR\&.
.SH "EXAMPLES"
.sp
.if n \{\
.RS 4
.\}
.nf
# 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
.fi
.if n \{\
.RE
.\}
.SH "CAVEATS"
.sp
There are situations when path 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 \fI\&.pacnew\fR 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\&.
.sp
PostTransaction hooks will \fBnot\fR run if the transaction fails to complete for any reason\&.
.sp
See the pacman website at https://archlinux\&.org/pacman/ for current information on pacman and its related tools\&.
.SH "BUGS"
.sp
Bugs? You must be kidding; there are no bugs in this software\&. But if we happen to be wrong, submit a bug report with as much detail as possible at the Arch Linux Bug Tracker in the Pacman section\&.
.SH "AUTHORS"
.sp
Current maintainers:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Allan McRae <allan@archlinux\&.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Andrew Gregory <andrew\&.gregory\&.8@gmail\&.com>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Eli Schwartz <eschwartz@archlinux\&.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Morgan Adamiec <morganamilo@archlinux\&.org>
.RE
.sp
Past major contributors:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Judd Vinet <jvinet@zeroflux\&.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Aurelien Foret <aurelien@archlinux\&.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Aaron Griffin <aaron@archlinux\&.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Dan McGee <dan@archlinux\&.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Xavier Chantry <shiningxc@gmail\&.com>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Nagy Gabor <ngaba@bibl\&.u\-szeged\&.hu>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Dave Reisner <dreisner@archlinux\&.org>
.RE
.sp
For additional contributors, use git shortlog \-s on the pacman\&.git repository\&.