You are not logged in.
I have encrypted SWAP partition and keyfile for it on my root LVM logical volume. I was going throught Arch wiki - mkinitcpio_hook solution and use AUR package mkinitcpio-openswap 0.0.0-2.
I have hooks like:
HOOKS="base udev autodetect modconf block keymap encrypt lvm2 openswap resume filesystems keyboard fsck shutdown"
In my case I had race conditions. While resume hook was executed, lvm2 is not finish, that openswap task can't read keyfile.
So, I writed solution for that (as 5 lines added to original mkinitcpio-openswap):
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
### these five lines are added by me to beat race conditions
x=0;
while [ ! -b "$keyfile_device" ] && [ $x -le 10 ]; do
x=$((x+1))
sleep .2
done
mkdir openswap_keymount
mount "$keyfile_device" openswap_keymount
cryptsetup open $miscellaneous --key-file "openswap_keymount/$keyfile_filename" "$swap_device" "$crypt_swap_name"
umount openswap_keymount
fi
}
Can someone tell me where I should that publish?
Last edited by bodolsog (2016-03-28 18:45:07)
Offline
Given that it's a pretty short script, it's not really suitable for the AUR. Adding it to the wiki is probably best unless you intend to expand and maintain it in which case publishing to GitHub (or similar), then writing a PKGBUILD would be appropriate.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline