xbps-triggers: add initramfs-regenerate trigger

This abstracts away the `dracut -f -q --regenerate-all` that appears in
nvidia and zfs packages, allowing users to disable global regeneration,
use dracut (by default, to preserve existing behavior) or mkinitcpio.
Eventually, this can be extended with initramfs-tools if we like.

Closes: #31403
This commit is contained in:
Andrew J. Hesford 2021-06-10 11:31:19 -04:00
parent 326f8ead70
commit 876b6ed3a4
3 changed files with 103 additions and 1 deletions

View file

@ -57,6 +57,7 @@ packages for XBPS, the `Void Linux` native packaging system.
* [gtk3-immodules](#triggers_gtk3_immodules)
* [hwdb.d-dir](#triggers_hwdb.d_dir)
* [info-files](#triggers_info_files)
* [initramfs-regenerate](#triggers_initramfs_regenerate)
* [kernel-hooks](#triggers_kernel_hooks)
* [mimedb](#triggers_mimedb)
* [mkdirs](#triggers_mkdirs)
@ -1881,6 +1882,35 @@ registry located at `usr/share/info`.
If it is running under another architecture it tries to use the host's `install-info`
utility.
<a id="triggers_initramfs_regenerate"></a>
### initramfs-regenerate
The initramfs-regenerate trigger will trigger the regeneration of all kernel
initramfs images after package installation or removal. The trigger must be
manually requested.
This hook is probably most useful for DKMS packages because it will provide a
means to include newly compiled kernel modules in initramfs images for all
currently available kernels. When used in a DKMS package, it is recommended to
manually include the `dkms` trigger *before* the `initramfs-regenerate` trigger
using, for example,
```
triggers="dkms initramfs-regenerate"
```
Although `xbps-src` will automatically include the `dkms` trigger whenever
`dkms_modules` is installed, the automatic addition will come *after*
`initramfs-regenerate`, which will cause initramfs images to be recreated
before the modules are compiled.
By default, the trigger uses `dracut --regenerate-all` to recreate initramfs
images. If `/etc/defalt/initramfs-regenerate` exists and defines
`INITRAMFS_GENERATOR=mkinitcpio`, the trigger will instead use `mkinitcpio` and
loop over all kernel versions for which modules appear to be installed.
Alternatively, setting `INITRAMFS_GENERATOR=none` will disable image
regeneration entirely.
<a id="triggers_kernel_hooks"></a>
#### kernel-hooks