nixos/luksroot: Check whether the device already exists

The new reuse behaviour is cool and really useful but it breaks one of
my use cases. When using kexec, I have a script which will unlock the
disks in my initrd. However, do_open_passphrase will fail if the disk is
already unlocked.
This commit is contained in:
Janne Heß 2018-11-12 20:34:19 +01:00
parent 7041972128
commit 9cd4ce98bf

View File

@ -118,6 +118,11 @@ let
do_open_passphrase() {
local passphrase
# Return if already unlocked
if ! cryptsetup status "${name}" > /dev/null; then
return
fi
while true; do
echo -n "Passphrase for ${device}: "
passphrase=