encrypt_install 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. build() {
  3. local mod
  4. add_module "dm-crypt"
  5. add_module "dm-integrity"
  6. if [[ $CRYPTO_MODULES ]]; then
  7. for mod in $CRYPTO_MODULES; do
  8. add_module "$mod"
  9. done
  10. else
  11. add_all_modules "/crypto/"
  12. fi
  13. add_binary "cryptsetup"
  14. add_binary "dmsetup"
  15. add_file "/usr/lib/udev/rules.d/10-dm.rules"
  16. add_file "/usr/lib/udev/rules.d/13-dm-disk.rules"
  17. add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
  18. add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
  19. # cryptsetup calls pthread_create(), which dlopen()s libgcc_s.so.1
  20. add_binary "/usr/lib/libgcc_s.so.1"
  21. add_runscript
  22. }
  23. help() {
  24. cat <<HELPEOF
  25. This hook allows for an encrypted root device. Users should specify the device
  26. to be unlocked using 'cryptdevice=device:dmname' on the kernel command line,
  27. where 'device' is the path to the raw device, and 'dmname' is the name given to
  28. the device after unlocking, and will be available as /dev/mapper/dmname.
  29. For unlocking via keyfile, 'cryptkey=device:fstype:path' should be specified on
  30. the kernel cmdline, where 'device' represents the raw block device where the key
  31. exists, 'fstype' is the filesystem type of 'device' (or auto), and 'path' is
  32. the absolute path of the keyfile within the device.
  33. Without specifying a keyfile, you will be prompted for the password at runtime.
  34. This means you must have a keyboard available to input it, and you may need
  35. the keymap hook as well to ensure that the keyboard is using the layout you
  36. expect.
  37. HELPEOF
  38. }
  39. # vim: set ft=sh ts=4 sw=4 et: