Skip to content

Commit

Permalink
attempt wipe if tpm2 slot already found so re-enroll can occur
Browse files Browse the repository at this point in the history
  • Loading branch information
bsherman committed Nov 2, 2024
1 parent 8d3c9ac commit c1a92f0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions build/ublue-os-luks/luks-enable-tpm2-autounlock
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ fi
if cryptsetup luksDump "$CRYPT_DISK" | grep systemd-tpm2 > /dev/null; then
KEYSLOT=$(cryptsetup luksDump "$CRYPT_DISK"|grep -A29 systemd-tpm2|grep Keyslot|awk '{print $2}')
echo "TPM2 already present in LUKS Keyslot $KEYSLOT of $CRYPT_DISK."
echo "Remove the existing TPM2 enrollment before trying again."
echo "Exiting..."
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
echo "Wiping systemd-tpm2 from LUKS Keyslot $KEYSLOT of $CRYPT_DISK."
systemd-cryptenroll --wipe-slot=$KEYSLOT "$CRYPT_DISK"
fi

## Run crypt enroll
Expand Down

0 comments on commit c1a92f0

Please sign in to comment.