Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init: assign CONFIG_TPM depending on /dev/tpm0 presence #1200

Merged
merged 2 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions initrd/bin/gui-init
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mount_boot()
exec /bin/usb-init
;;
m )
skip_to_menu="true"
skip_gpg_check="true"
break
;;
* )
Expand Down Expand Up @@ -571,7 +571,9 @@ else
fi

# detect whether any GPG keys exist in the keyring, if not, initialize that first
[[ "$skip_to_menu" != "true" ]] && check_gpg_key && update_totp && update_hotp
[[ "$skip_gpg_check" != "true" ]] && check_gpg_key

update_totp && update_hotp

if [[ "$HOTP" = "Success" && $CONFIG_AUTO_BOOT_TIMEOUT ]]; then
prompt_auto_default_boot
Expand Down
13 changes: 13 additions & 0 deletions initrd/init
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ hwclock -l -s
. /etc/functions
. /etc/config

# set CONFIG_TPM dynamically before init
if [ -e /dev/tpm0 ]; then
CONFIG_TPM='y'
else
CONFIG_TPM='n'
fi

#Specify whiptail background colors cues under FBWhiptail only
if [ -x /bin/fbwhiptail ]; then
export BG_COLOR_WARNING="${CONFIG_WARNING_BG_COLOR:-"--background-gradient 0 0 0 150 125 0"}"
Expand Down Expand Up @@ -97,6 +104,12 @@ if [ "$boot_option" = "r" ]; then
exit
fi

# Override CONFIG_TPM from /etc/config with runtime value determined above.
#
# Values in user config have higher priority during combining thus effectively
# changing the value for the rest of the scripts which source /tmp/config.
echo "export CONFIG_TPM=\"$CONFIG_TPM\"" >> /etc/config.user

combine_configs
. /tmp/config

Expand Down