kexec-save-default: Fix multiple LUKS/LVM+LUKS suggestion + other working uniformization for DUK

This commit is contained in:
Thierry Laurion 2023-09-02 11:49:57 -04:00
parent e291797e65
commit 47eba7d80b
No known key found for this signature in database
GPG Key ID: E7B4A71658E36A93

View File

@ -46,7 +46,7 @@ elif [ -z "$lvm_suggest" ]; then
num_lvm=0 num_lvm=0
fi fi
# $lvm_suggest is a multiline string, we need to convert it to a space separated string # $lvm_suggest is a multiline string, we need to convert it to a space separated string
lvm_suggest=$(echo "$lvm_suggest" | xargs) lvm_suggest=$(echo $lvm_suggest | tr '\n' ' ')
DEBUG "LVM num_lvm: $num_lvm, lvm_suggest: $lvm_suggest" DEBUG "LVM num_lvm: $num_lvm, lvm_suggest: $lvm_suggest"
# get all LUKS container devices # get all LUKS container devices
@ -61,7 +61,7 @@ elif [ -z "$devices_suggest" ]; then
num_devices=0 num_devices=0
fi fi
# $devices_suggest is a multiline string, we need to convert it to a space separated string # $devices_suggest is a multiline string, we need to convert it to a space separated string
devices_suggest=$(echo "$devices_suggest" | xargs) devices_suggest=$(echo $devices_suggest | tr '\n' ' ')
DEBUG "LUKS num_devices: $num_devices, devices_suggest: $devices_suggest" DEBUG "LUKS num_devices: $num_devices, devices_suggest: $devices_suggest"
if [ "$num_lvm" -eq 0 ] && [ "$num_devices" -eq 0 ]; then if [ "$num_lvm" -eq 0 ] && [ "$num_devices" -eq 0 ]; then
@ -218,7 +218,7 @@ if [ "$CONFIG_TPM" = "y" ] && [ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" != "y" ] && [
save_key="y" save_key="y"
fi fi
else else
DEBUG "No previous TPM Disk Unlock Key was set up for LUKS devices, confirming to add a disk encryption to the TPM" DEBUG "No previous TPM Disk Unlock Key was set up for LUKS devices, confirming to add a Disk Encryption Key to the TPM"
read \ read \
-n 1 \ -n 1 \
-p "Do you wish to add a disk encryption to the TPM [y/N]: " \ -p "Do you wish to add a disk encryption to the TPM [y/N]: " \
@ -227,7 +227,7 @@ if [ "$CONFIG_TPM" = "y" ] && [ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" != "y" ] && [
if [ "$add_key_confirm" = "y" \ if [ "$add_key_confirm" = "y" \
-o "$add_key_confirm" = "Y" ]; then -o "$add_key_confirm" = "Y" ]; then
DEBUG "User confirmed to add a disk encryption to the TPM" DEBUG "User confirmed desire to add a Disk Encryption Key to the TPM"
save_key="y" save_key="y"
fi fi
fi fi
@ -252,7 +252,7 @@ if [ "$CONFIG_TPM" = "y" ] && [ "$CONFIG_TPM_NO_LUKS_DISK_UNLOCK" != "y" ] && [
prompt_for_existing_encrypted_lvms_or_disks prompt_for_existing_encrypted_lvms_or_disks
fi fi
else else
DEBUG "No previous TPM Disk Unlock Key was set up for LUKS devices, setting up new ones" DEBUG "No previous TPM Disk Unlock Key was set up for LUKS devices, setting up new one"
prompt_for_existing_encrypted_lvms_or_disks prompt_for_existing_encrypted_lvms_or_disks
fi fi