Skip to content

Instantly share code, notes, and snippets.

@vishalbelsare
Created June 1, 2023 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishalbelsare/a1d7dcb6ed065f7f9b5766a3c8246299 to your computer and use it in GitHub Desktop.
Save vishalbelsare/a1d7dcb6ed065f7f9b5766a3c8246299 to your computer and use it in GitHub Desktop.
mkinitcpio build hook for dm-integrity devices
#!/bin/bash
build() {
local mod
add_module 'dm-integrity'
add_module 'dm-bufio'
add_module 'dm-mod'
add_module 'async_xor'
map add_udev_rule \
'10-dm.rules' \
'13-dm-disk.rules' \
'95-dm-notify.rules' \
'/usr/lib/initcpio/udev/11-dm-initramfs.rules'
map add_systemd_unit 'integritysetup.target'
map add_binary \
'/usr/lib/systemd/system-generators/systemd-integritysetup-generator' \
'/usr/lib/systemd/systemd-integritysetup'
# integritysetup calls pthread_create(), which dlopen()s libgcc_s.so.1
add_binary '/usr/lib/libgcc_s.so.1'
[[ -f /etc/integritytab.initramfs ]] && add_file '/etc/integritytab.initramfs' '/etc/integritytab'
}
help() {
cat <<HELPEOF
This hook allows for a dm-integrity root device with systemd initramfs.
See the manpage of systemd-integritysetup-generator(8) for available kernel
command line options. Alternatively, if the file /etc/integritytab.initramfs
exists, it will be added to the initramfs as /etc/integritytab. See the
integritytab(5) manpage for more information on integritytab syntax.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment