install-encrypt 1.6 KB

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