23 lines
556 B
Bash
23 lines
556 B
Bash
# vim: set ft=sh:
|
|
# shellcheck shell=sh
|
|
#
|
|
# false positive
|
|
# shellcheck disable=2154
|
|
#
|
|
# word splitting is safe by design
|
|
# shellcheck disable=2068
|
|
{
|
|
[ "$break" = luks ] && { print "break before unlock_luks()"; sh; }
|
|
|
|
export DM_DISABLE_UDEV=1
|
|
mkdir -p /run/cryptsetup
|
|
|
|
resolve_device "$luks_root"
|
|
|
|
set -- \
|
|
"${luks_discard:+--allow-discards}" "${luks_header:+--header $luks_header}" \
|
|
"${luks_key:+-d $luks_key}" "$device" "${luks_name:-crypt-${device##*/}}"
|
|
|
|
cryptsetup open $@ || panic "failed to unlock LUKS"
|
|
}
|