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

Fix name of secureboot requirement #167

Merged
merged 13 commits into from
May 2, 2024
Merged

Conversation

simondeziel
Copy link
Member

@simondeziel simondeziel commented May 2, 2024

Fixes canonical/lxd#13409

Also, fix/improve a few things along the way.

It's too bad that bin/test-image cannot consult the image requirements otherwise it would have been possible to look if the image being tested is not going to work with secureboot. For now I hardcoded the known incompatible distros but if @MusicDin you know better, please let me know!

@simondeziel simondeziel marked this pull request as ready for review May 2, 2024 00:49
@simondeziel simondeziel requested review from tomponline and MusicDin May 2, 2024 00:49
bin/test-image Outdated
# Some distros don't support secure boot.
case "${DISTRO}" in
alpine|archlinux|gentoo|nixos)
lxc config set "${TEST_IMAGE}" security.secureboot=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt this be false?

Whats with the ) at the end but no starting bracket, is this some weird bash-ism?

Copy link
Member Author

@simondeziel simondeziel May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, indeed, false it should have been. Fixed, thanks.

As for the ) missing the opening one, it is not a bashism but now that you call it out it looks weird. man dash:

The syntax of the case command is

       case word in
       [(]pattern) list ;;
       ...
       esac

The pattern can actually be one or more patterns (see Shell Patterns described later), separated by “|” characters.
The “(” character before the pattern is optional.

I don't remember seeing case with an opening ( though. I'm fine introducing it if that reads better for you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok thanks, from my PHP, Java, Go, C eyes thats a definite code smell, but seems like its ok in shell.

While copying even 1GiB worth of a desktop VM image is quick, it wastes disks
and is not needed as `lxc image import` is only reading from the source files.

Signed-off-by: Simon Deziel <[email protected]>
https://www.freedesktop.org/software/systemd/man/latest/sd_booted.html:
> Internally, this function checks whether the directory /run/systemd/system/
> exists. A simple check like this can also be implemented trivially in shell
> or any other language.

Signed-off-by: Simon Deziel <[email protected]>
Previously, a failure from `./bin/test-image` would abort immediatly due to
`set -e`. Now, we get a chance of echo'ing that it failed.

Signed-off-by: Simon Deziel <[email protected]>
@tomponline tomponline merged commit ec914d0 into canonical:main May 2, 2024
62 of 63 checks passed
@tomponline
Copy link
Member

Thanks!

@simondeziel simondeziel deleted the secureboot branch May 2, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alpine image (and maybe more) have requirements.secure_boot: false but LXD checks for requirements.secureboot
2 participants