Fixed postrun script

This commit is contained in:
Raphaël Numbus
2026-02-15 16:34:57 +01:00
parent 88e8d8603f
commit 7838773ce5
+9 -6
View File
@@ -928,15 +928,18 @@ postrun_action() {
ssh_to_host 'bash -s' << EOF ssh_to_host 'bash -s' << EOF
echo "Enrolling boot disk key to TPM..." echo "Enrolling boot disk key to TPM..."
BOOT_DISKS_ID=(${BOOT_DISKS_ID[@]})
DISK_PATH=""
j=1 j=1
for i in ${!BOOT_DISKS_ID[@]}; do
if [[ echo "${BOOT_DISKS_ID[${i}]}" | grep -iq "nvme" ]]; then for i in \${!BOOT_DISKS_ID[@]}; do
DISK_PATH="/dev/${BOOT_DISKS_ID[${i}]}p2" if [[ echo "\${BOOT_DISKS_ID[\${i}]}" | grep -iq "nvme" ]]; then
DISK_PATH="/dev/\${BOOT_DISKS_ID[\${i}]}p2"
else else
DISK_PATH="/dev/${BOOT_DISKS_ID[${i}]}2" DISK_PATH="/dev/\${BOOT_DISKS_ID[\${i}]}2"
fi fi
echo ${REMOTE_PASS} | sudo -S systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 --unlock-key-file=/etc/secrets/disks/boot-${j} ${DISK_PATH} echo ${REMOTE_PASS} | sudo -S systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 --unlock-key-file=/etc/secrets/disks/boot-\${j} \${DISK_PATH}
((j++)) j=\$((j + 1))
done done
echo "Getting PCRS 15 hash..." echo "Getting PCRS 15 hash..."