install-sd-encrypt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. build() {
  3. local mod
  4. add_module "dm-crypt"
  5. if [[ $CRYPTO_MODULES ]]; then
  6. for mod in $CRYPTO_MODULES; do
  7. add_module "$mod"
  8. done
  9. else
  10. add_all_modules "/crypto/"
  11. fi
  12. add_binary "dmsetup"
  13. add_file "/usr/lib/udev/rules.d/10-dm.rules"
  14. add_file "/usr/lib/udev/rules.d/13-dm-disk.rules"
  15. add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
  16. add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
  17. add_systemd_unit "cryptsetup.target"
  18. add_binary "/usr/lib/systemd/system-generators/systemd-cryptsetup-generator"
  19. add_binary "/usr/lib/systemd/systemd-cryptsetup"
  20. add_systemd_unit "systemd-ask-password-console.path"
  21. add_systemd_unit "systemd-ask-password-console.service"
  22. # cryptsetup calls pthread_create(), which dlopen()s libgcc_s.so.1
  23. add_binary "/usr/lib/libgcc_s.so.1"
  24. # add mkswap for creating swap space on the fly (see 'swap' in crypttab(5))
  25. add_binary "mkswap"
  26. [[ -f /etc/crypttab.initramfs ]] && add_file "/etc/crypttab.initramfs" "/etc/crypttab"
  27. }
  28. help() {
  29. cat <<HELPEOF
  30. This hook allows for an encrypted root device with systemd initramfs.
  31. See the manpage of systemd-cryptsetup-generator(8) for available kernel
  32. command line options. Alternatively, if the file /etc/crypttab.initramfs
  33. exists, it will be added to the initramfs as /etc/crypttab. See the
  34. crypttab(5) manpage for more information on crypttab syntax.
  35. HELPEOF
  36. }
  37. # vim: set ft=sh ts=4 sw=4 et: