luksroot waits for usb drive

svn path=/nixos/trunk/; revision=31129
This commit is contained in:
Florian Friesdorf 2011-12-28 21:46:42 +00:00
parent dd8e725d7d
commit 0a9f3a36ec

View file

@ -45,6 +45,19 @@ in
'';
boot.initrd.postDeviceCommands = ''
# Wait for luksRoot to appear, e.g. if on a usb drive.
# XXX: copied and adapted from stage-1-init.sh - should be
# available as a function.
if ! test -e ${luksRoot}; then
echo -n "waiting for device ${luksRoot} to appear..."
for ((try = 0; try < 10; try++)); do
sleep 1
if test -e ${luksRoot}; then break; fi
echo -n "."
done
echo "ok"
fi
# open luksRoot and scan for logical volumes
cryptsetup luksOpen ${luksRoot} luksroot
lvm vgscan
lvm vgchange -ay