summaryrefslogtreecommitdiff
path: root/pcr/mkinitcpio-openswap/openswap.hook
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2017-07-02 18:45:15 -0400
committerDavid P <megver83@parabola.nu>2017-07-02 18:45:15 -0400
commitf98362f371e259fa45b089c4183a5035285beb65 (patch)
tree5195363751bef1d753590eeffd235b287f03e469 /pcr/mkinitcpio-openswap/openswap.hook
parent1b1185741639651b65d2953c06a64090e9a16df6 (diff)
downloadabslibre-f98362f371e259fa45b089c4183a5035285beb65.tar.gz
abslibre-f98362f371e259fa45b089c4183a5035285beb65.tar.bz2
abslibre-f98362f371e259fa45b089c4183a5035285beb65.zip
Added pythonqt and mkinitcpio-openswap to [pcr]
Diffstat (limited to 'pcr/mkinitcpio-openswap/openswap.hook')
-rw-r--r--pcr/mkinitcpio-openswap/openswap.hook17
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
+}