summaryrefslogtreecommitdiff
path: root/pcr/mkinitcpio-openswap/openswap.hook
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/mkinitcpio-openswap/openswap.hook')
-rw-r--r--pcr/mkinitcpio-openswap/openswap.hook12
1 files changed, 10 insertions, 2 deletions
diff --git a/pcr/mkinitcpio-openswap/openswap.hook b/pcr/mkinitcpio-openswap/openswap.hook
index ead4c4f86..9a96ad4b3 100644
--- a/pcr/mkinitcpio-openswap/openswap.hook
+++ b/pcr/mkinitcpio-openswap/openswap.hook
@@ -1,12 +1,20 @@
run_hook ()
{
## read openswap configurations
- source openswap.conf
+ source /openswap.conf
+
+ ## Optional: To avoid race conditions
+ x=0;
+ while [ ! -b "$keyfile_device" ] && [ $x -le 10 ]; do
+ x=$((x+1))
+ sleep .2
+ done
+ ## End of optional
if [ -z "$keyfile_device" ] || [ -z "$keyfile_filename" ]
then
## case when no keyfile provided in configurations
- cryptsetup open "$swap_device" "$crypt_swap_name"
+ cryptsetup open $cryptsetup_options "$swap_device" "$crypt_swap_name"
else
## case when keyfile is provided in configurations
mkdir openswap_keymount