diff options
Diffstat (limited to 'pcr/mkinitcpio-openswap/openswap.hook')
-rw-r--r-- | pcr/mkinitcpio-openswap/openswap.hook | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pcr/mkinitcpio-openswap/openswap.hook b/pcr/mkinitcpio-openswap/openswap.hook new file mode 100644 index 000000000..ead4c4f86 --- /dev/null +++ b/pcr/mkinitcpio-openswap/openswap.hook @@ -0,0 +1,17 @@ +run_hook () +{ + ## read openswap configurations + source openswap.conf + + if [ -z "$keyfile_device" ] || [ -z "$keyfile_filename" ] + then + ## case when no keyfile provided in configurations + cryptsetup open "$swap_device" "$crypt_swap_name" + else + ## case when keyfile is provided in configurations + mkdir openswap_keymount + mount $keyfile_device_mount_options "$keyfile_device" openswap_keymount + cryptsetup open $cryptsetup_options --key-file "openswap_keymount/$keyfile_filename" "$swap_device" "$crypt_swap_name" + umount openswap_keymount + fi +} |