mirror of
https://github.com/linuxboot/heads.git
synced 2025-02-21 09:31:51 +00:00
Merge pull request #747 from MrChromebox/factory_reset_no_tpm
oem-factory-reset: Handle non-TPM case
This commit is contained in:
commit
94476bb470
@ -127,6 +127,7 @@ generate_checksums()
|
||||
rm /boot/kexec* 2>/dev/null
|
||||
|
||||
# create Heads TPM counter
|
||||
if [ "$CONFIG_TPM" = "y" ]; then
|
||||
tpm counter_create \
|
||||
-pwdo "$TPM_PASS_DEF" \
|
||||
-pwdc '' \
|
||||
@ -142,6 +143,10 @@ generate_checksums()
|
||||
# create rollback file
|
||||
sha256sum /tmp/counter-$TPM_COUNTER > /boot/kexec_rollback.txt 2>/dev/null \
|
||||
|| whiptail_error_die "Unable to create rollback file"
|
||||
else
|
||||
## needs to exist for initial call to unseal-hotp
|
||||
echo "0" > /boot/kexec_hotp_counter
|
||||
fi
|
||||
|
||||
# set default boot option
|
||||
set_default_boot_option
|
||||
@ -232,9 +237,14 @@ else
|
||||
fi
|
||||
|
||||
# show warning prompt
|
||||
if [ "$CONFIG_TPM" = "y" ]; then
|
||||
TPM_STR=" * ERASE the TPM and reset it with a default password\n"
|
||||
else
|
||||
TPM_STR=""
|
||||
fi
|
||||
if ! whiptail --yesno "
|
||||
This operation will automatically:\n\n
|
||||
* ERASE the TPM and reset it with a default password\n
|
||||
$TPM_STR
|
||||
* ERASE any keys or passwords on the GPG smart card,\n
|
||||
reset it to a factory state, and generate new keys\n
|
||||
* Add the new GPG key to the firmware and reflash it\n
|
||||
@ -337,6 +347,7 @@ replace_config /etc/config.user "CONFIG_BOOT_DEV" "$CONFIG_BOOT_DEV"
|
||||
combine_configs
|
||||
|
||||
## reset TPM and set default password
|
||||
if [ "$CONFIG_TPM" = "y" ]; then
|
||||
echo -e "\nResetting TPM...\n"
|
||||
{
|
||||
echo $TPM_PASS_DEF
|
||||
@ -346,6 +357,7 @@ if [ $? -ne 0 ]; then
|
||||
ERROR=$(tail -n 1 /tmp/error)
|
||||
whiptail_error_die "Error resetting TPM:\n\n${ERROR}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# clear local keyring
|
||||
rm /.gnupg/*.gpg 2>/dev/null
|
||||
|
Loading…
x
Reference in New Issue
Block a user