-
Notifications
You must be signed in to change notification settings - Fork 38
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
base: initramfs: check for secure boot #1527
base: main
Are you sure you want to change the base?
Conversation
Using efivar --print-decimal returns an integer. Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
@ricardosalveti please could we merge this. I have noticed errors on qemu with the previous validation code. thx. |
@@ -7,7 +7,7 @@ cryptfs_check_tpm2() { | |||
# Check for SecureBoot support as PCR 7 differs based on its state | |||
efi_secure=`efivar --name=8be4df61-93ca-11d2-aa0d-00e098032b8c-SecureBoot --print-decimal` | |||
efi_mode=`efivar --name=8be4df61-93ca-11d2-aa0d-00e098032b8c-SetupMode --print-decimal` | |||
if [ "${efi_secure}" != "1" ] || [ "${efi_mode}" != "0" ]; then | |||
if [ "${efi_secure}" -ne 1 ] || [ "${efi_mode}" -ne 0 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should drop quotation marks for the first operand, same in meta-lmp-base/recipes-core/initrdscripts/initramfs-module-install-efi/init-install-efi.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesnt really matter in this particular case - all bash variables are strings anyway. it is safer and good practice to keep the quotes in case there are spaces and so on...
Which errors? Looks like this won't change the actual functionality of the code. |
I added some traces for you so you can see how bash works. Notice the delimiters around the variable
This generates the following error on output even though secure boot was enabled (secure = 1, mode = 0)
basically the trailing space makes the difference. the sooner we merge, the better :) |
just cross-checked on my laptop, you're right, --print-decimal actually prints a value with an additional trailing space:
imo, why not to trim it with xargs for example (so it looks much more obvious what kind of an issue the commit addresses + add that information in commit message):
|
Using standard solutions to standard problems is usually the better thing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a fix for another commit. Could you please add a "Fixed:" field?
Using efivar --print-decimal returns an integer.