summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenya Sovetkin2017-10-27 16:46:20 +0200
committerJenya Sovetkin2017-10-27 16:46:20 +0200
commitb2c87aa33c4af2bb4a2bb80f1850b6e8cfe3651e (patch)
treeb131cc61a8fa0d7dc5b3c5eb737f020ff577bd9d
parenta44a836f208d80216087b6187424b2facb5031b7 (diff)
downloadaur-mkinitcpio-openswap.tar.gz
fixing path and racing condition
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--openswap.hook10
3 files changed, 13 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e2eaddef7d5a..df4ae9a94f6a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = mkinitcpio-openswap
pkgdesc = mkinitcpio hook to open swap at boot time
pkgver = 0.1.0
- pkgrel = 2
+ pkgrel = 3
url = https://aur.archlinux.org/packages/mkinitcpio-openswap/
install = usage.install
arch = any
@@ -11,7 +11,7 @@ pkgbase = mkinitcpio-openswap
source = openswap.hook
source = openswap.install
source = openswap.conf
- sha256sums = b3ba16919450c229093adfbb758b72e2b31a8cbbc25e42e47693b9d0f4cc8a5b
+ sha256sums = 84ef428386b7f4353af036ccfbd4c60901a76e2d0c7a38dd3be2000219ea9d23
sha256sums = 94dd98a953bab2244215a2b20767cdc9500fc438bed9ec27cae72a73766c6b86
sha256sums = 3308f2679bb7c962d98adf2684d25390025d025e3d30bc1e773e3522311ad325
diff --git a/PKGBUILD b/PKGBUILD
index d3e7b26aa61a..a6bad295862b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
# Contributors: https://aur.archlinux.org/account/f4bio
pkgname=mkinitcpio-openswap
pkgver=0.1.0
-pkgrel=2
+pkgrel=3
pkgdesc="mkinitcpio hook to open swap at boot time"
arch=(any)
license=('unknown')
@@ -13,7 +13,7 @@ install="usage.install"
source=('openswap.hook'
'openswap.install'
'openswap.conf')
-sha256sums=('b3ba16919450c229093adfbb758b72e2b31a8cbbc25e42e47693b9d0f4cc8a5b'
+sha256sums=('84ef428386b7f4353af036ccfbd4c60901a76e2d0c7a38dd3be2000219ea9d23'
'94dd98a953bab2244215a2b20767cdc9500fc438bed9ec27cae72a73766c6b86'
'3308f2679bb7c962d98adf2684d25390025d025e3d30bc1e773e3522311ad325')
diff --git a/openswap.hook b/openswap.hook
index 9aad79a29c2d..9a96ad4b3ced 100644
--- a/openswap.hook
+++ b/openswap.hook
@@ -1,7 +1,15 @@
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