-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathxbps.hook.5
More file actions
187 lines (185 loc) · 3.79 KB
/
xbps.hook.5
File metadata and controls
187 lines (185 loc) · 3.79 KB
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
.Dd December 22, 2025
.Dt XBPS.HOOK 5
.Os
.Sh NAME
.Nm xbps.hook
.Nd XBPS hook configuration
.Sh SYNOPSIS
.Bl -item -compact
.It
/etc/xbps.d/hooks/*.hook
.It
/usr/share/xbps.d/hooks/*.hook
.El
.Sh DESCRIPTION
The
.Nm
files are
.So .ini Sc Ns -style
configuration files to define hooks that execute commands at certain points of
the xbps transactions
.Po
package updates,
installs,
and removals.
.Pc
.Pp
Comments can be put anywhere in the file
and using hashmarks
.Pq Sq # ,
or
semi-colons
.Pq Sq \&; ,
and are continued to the end of the line.
.Sh [HOOK] SECTION OPTIONS
The
.Ic Hook
section is required and defines when the hook is executed and the command that
is being executed as part of the hook.
.Bl -tag -width -x
.It Sy Name = Ar name
Set the hook name used for logging.
.It Ic When = Ar option ...
Defines when the hook is executed.
The following values are supported
and multiple values can be set by
separating them with a space or defining
the
.Sy When
option multiple times.
Valid options are:
.Bl -tag -width -x
.It Ic PreTransaction
Before all packages are installed,
updated,
or removed.
.It Ic PostTransaction
After all packages are installed,
updated,
or removed.
.El
.It Sy Exec = Ar command Op Ar args ...
Command that is executed.
The
.Ar command
and
.Ar args
are split into words according to
.Sx WORD SPLITTING .
.El
.Sh [MATCH] SECTION OPTIONS
A hook is executed if it's
.Ic Match
section matches the current transaction.
.Bl -tag -width -x
.It Ic Package = Ar pkgname | Ar pkgpattern
Matches if
.Ar pkgname
or packages matching
.Ar pkgpattern
are installed,
updated,
removed,
reinstalled,
or configured in the transaction.
.It Ic PackageInstall = Ar pkgname | Ar pkgpattern
Matches if
.Ar pkgname
or packages matching
.Ar pkgpattern
are installed in the transaction.
.It Ic PackageUpdate = Ar pkgname | Ar pkgpattern
Matches if
.Ar pkgname
or packages matching
.Ar pkgpattern
are updated in the transaction.
.It Ic PackageRemove = Ar pkgname | Ar pkgpattern
Matches if
.Ar pkgname
or packages matching
.Ar pkgpattern
are removed in the transaction.
.It Ic PackageReinstall = Ar pkgname | Ar pkgpattern
Matches if
.Ar pkgname
or packages matching
.Ar pkgpattern
are reinstalled in the transaction.
.It Ic PackageConfigure = Ar pkgname | Ar pkgpattern
Matches if
.Ar pkgname
or packages matching
.Ar pkgpattern
are configured in the transaction.
.It Ic Path = Ar path | Ar pattern
Matches if
.Ar path
or paths matching
.Ar pattern
are created,
modified,
or deleted.
.It Ic PathCreated = Ar path | Ar pattern
Matches if
.Ar path
or paths matching
.Ar pattern
are created in the transaction.
.It Ic PathModified = Ar path | Ar pattern
Matches if
.Ar path
or paths matching
.Ar pattern
are modified in the transaction.
.It Ic PathDeleted = Ar path | Ar pattern
Matches if
.Ar path
or paths matching
.Ar pattern
are deleted in the transaction.
.El
.Sh WORD SPLITTING
Options which support multiple free text values will be split into separate
words.
The word boundaries are spaces
.Pq Sq \~
and tabs
.Pq Sq \et .
.Pp
If a word contains a literal space
.Pq Sq \~
or tab
.Pq Sq \et ,
use a backslash
.Pq Sq \e
to escape the character.
.Sh EXAMPLES
The following example restarts the
.Ic sshd
service after the
.Ic ssh
package was updated.
.Bd -literal -offset indent
[Hook]
Name = Restart sshd.
When = PostTransaction
Exec = sv restart /var/service/sshd
[Match]
PackageUpdate = ssh
.Ed
.Pp
This example hook will sign the
.Pa systemd-bootx64.efi
file whenever it is updated or installed.
.Bd -literal -offset indent
[Hook]
Name = Sign the bootloader file.
When = PostTransaction
Exec = sbsign --key /etc/kernel/secure-boot.key.pem \e
--cert /etc/kernel/secure-boot.cert.pem \e
--output /usr/lib/systemd/boot/efi/systemd-bootx64.efi.signed \e
/usr/lib/systemd/boot/efi/systemd-bootx64.efi
[Match]
PathModified = /usr/lib/systemd/boot/efi/systemd-bootx64.efi
.Ed