From 29f3fcf4a167b9c54416a2bd72b0aa3f6220a249 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Tue, 3 Jul 2018 08:22:05 -0400 Subject: [mkinitcpio-openswap]: source openswap.conf by absolute path --- pcr/mkinitcpio-openswap/PKGBUILD | 18 +++++++++++++----- pcr/mkinitcpio-openswap/openswap.hook | 12 ++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/pcr/mkinitcpio-openswap/PKGBUILD b/pcr/mkinitcpio-openswap/PKGBUILD index fa71cff9d..90d0f940a 100644 --- a/pcr/mkinitcpio-openswap/PKGBUILD +++ b/pcr/mkinitcpio-openswap/PKGBUILD @@ -1,9 +1,17 @@ # Maintainer: David P. -# Contributor: Jenya Sovetkin +# Maintainer (AUR): Jenya Sovetkin # Contributor: https://aur.archlinux.org/account/f4bio +# NOTE: since the time that this package was taken from the AUR at verion 0.1.0, + the AUR maintainer has made multiple significant changes + without incrementing the version number from 0.1.0 + this version corresponds to the 2017-10-27 bugfix commit: + b2c87aa33c4af2bb4a2bb80f1850b6e8cfe3651e + "fixing path and racing condition" + + pkgname=mkinitcpio-openswap -pkgver=0.1.0 +pkgver=0.1.1 pkgrel=1 pkgdesc="mkinitcpio hook to open swap at boot time" arch=(any) @@ -15,12 +23,12 @@ install="usage.install" source=('openswap.hook' 'openswap.install' 'openswap.conf') -sha256sums=('ec55cff2d8f71eae70535e706445edb41f416350245b7aa7b322581fd3b38bae' +sha256sums=('84ef428386b7f4353af036ccfbd4c60901a76e2d0c7a38dd3be2000219ea9d23' '94dd98a953bab2244215a2b20767cdc9500fc438bed9ec27cae72a73766c6b86' '3308f2679bb7c962d98adf2684d25390025d025e3d30bc1e773e3522311ad325') - -package() { + +package() { install -Dm 644 openswap.hook \ "${pkgdir}/usr/lib/initcpio/hooks/openswap" install -Dm 644 openswap.install \ 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 -- cgit v1.2.3