|
| 1 | +.Dd December 22, 2025 |
| 2 | +.Dt XBPS.HOOK 5 |
| 3 | +.Os |
| 4 | +.Sh NAME |
| 5 | +.Nm xbps.hook |
| 6 | +.Nd XBPS hook configuration |
| 7 | +.Sh SYNOPSIS |
| 8 | +.Bl -item -compact |
| 9 | +.It |
| 10 | +/etc/xbps.d/hooks/*.conf |
| 11 | +.It |
| 12 | +/usr/share/xbps.d/hooks/*.conf |
| 13 | +.El |
| 14 | +.Sh DESCRIPTION |
| 15 | +The |
| 16 | +.Nm |
| 17 | +are |
| 18 | +.So .ini Sc Ns -style |
| 19 | +configuration files to define hooks. |
| 20 | +Comments can be put anywhere in the file |
| 21 | +and using hashmarks |
| 22 | +.Pq Sq # , |
| 23 | +or |
| 24 | +semicolons |
| 25 | +.Pq Sq ; , |
| 26 | +and are continue to the end of the line. |
| 27 | +.Sh [HOOK] SECTION OPTIONS |
| 28 | +.Bl -tag -width -x |
| 29 | +.It Sy Name= |
| 30 | +Set the hook name used used for logging. |
| 31 | +.It Sy Exec= Ar command Op Ar args ... |
| 32 | +The command executed by the hook. |
| 33 | +The value is split into words, |
| 34 | +and passed to |
| 35 | +.Xr execv 3 , |
| 36 | +spaces and tabs can be escaped using a |
| 37 | +backslash |
| 38 | +.Pq Sq \e . |
| 39 | +.It Ic When Ns = Oo Ic PreTransaction | Ic PostTransaction Oc |
| 40 | +Defines when the hook is executed. |
| 41 | +The following values are supported |
| 42 | +and multiple values can be set by |
| 43 | +separating them with a space or defining |
| 44 | +the |
| 45 | +.Sy When |
| 46 | +option multiple times. |
| 47 | +Possible values are: |
| 48 | +.Bl -tag -width -x |
| 49 | +.It Ic PreTransaction |
| 50 | +Before packages are installed, |
| 51 | +updated, |
| 52 | +or removed. |
| 53 | +.It Ic PostTransaction |
| 54 | +After package are installed, |
| 55 | +updated, |
| 56 | +or removed. |
| 57 | +.El |
| 58 | +.El |
| 59 | +.Sh [MATCH] SECTION OPTIONS |
| 60 | +The |
| 61 | +.Sy Match |
| 62 | +section can be defined multiple times. |
| 63 | +.Bl -tag -width -x |
| 64 | +.It Ic Action Ns = Oo Ic Install | Ic Remove | Ic Update | Ic Configure Oc |
| 65 | +Set the hook name used used for logging. |
| 66 | +.It Ic Path Ns = Oo Ar path ... | Ar pattern ... Oc |
| 67 | +.It Ic Package Ns = Oo Ar pkgname ... | Ar pkgpattern ... Oc |
| 68 | +.Sh EXAMPLES |
| 69 | +The following example restarts the |
| 70 | +.Ic sshd |
| 71 | +service after the |
| 72 | +.Ic ssh |
| 73 | +package was updated. |
| 74 | +.Pp |
| 75 | +.Pp |
| 76 | +.Bd -literal -offset indent |
| 77 | +[Hook] |
| 78 | +Name = Restart sshd. |
| 79 | +When = PostTransaction |
| 80 | +Exec = sv restart /var/service/sshd |
| 81 | + |
| 82 | +[Match] |
| 83 | +Action = Update |
| 84 | +Package = ssh |
| 85 | +.Ed |
| 86 | +.Pp |
| 87 | +This example hook will sign the |
| 88 | +.Pa systemd-bootx64.efi |
| 89 | +file whenever it is being updated or installed. |
| 90 | +.Bd -literal -offset indent |
| 91 | +[Hook] |
| 92 | +Name = Sign the bootloader file. |
| 93 | +When = PostTransaction |
| 94 | +Exec = sbsign --key /etc/kernel/secure-boot.key.pem \e |
| 95 | + --cert /etc/kernel/secure-boot.cert.pem \e |
| 96 | + --output /usr/lib/systemd/boot/efi/systemd-bootx64.efi.signed \e |
| 97 | + /usr/lib/systemd/boot/efi/systemd-bootx64.efi |
| 98 | + |
| 99 | +[Match] |
| 100 | +Action = Install Update |
| 101 | +Path = /usr/lib/systemd/boot/efi/systemd-bootx64.efi |
| 102 | +.Ed |
0 commit comments