-
Notifications
You must be signed in to change notification settings - Fork 29
Extend generate-update-metadata()
to read from /usr
#938
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: main
Are you sure you want to change the base?
Conversation
01b09e0
to
be19115
Compare
54d905f
to
fa2e65c
Compare
fa2e65c
to
2a8961f
Compare
d31c745
to
ae28fbc
Compare
In `generate-update-metadata()`, checks `/usr/lib/efi/(shim|grub) /%{version}-%{release}/EFI/` first for EFI path, for example: `usr/lib/efi/shim/1.2-3/EFI/`. If the path `/usr/lib/efi` doesn’t exist, falls back to the legacy OSTree location `/usr/lib/ostree-boot/efi/EFI/`. Then move existing EFI path to the `/usr/lib/bootupd/updates/`. See coreos#926
ae28fbc
to
efa3b42
Compare
Ready for reviewing now. I did testing under fedora-bootc container, and upgrade Build new version according to #926 (comment): Download and prepare the repo
Build patch
Run testing under fedora-bootc container
|
Thanks Colin's PR coreos#936
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.
Overall looks sane to me, a variety of comments. I don't have anything blocking.
I think we should be testing this scenario in CI, I doubt we are? I am not up to date on things, does it require us pulling in a copr?
let dest_efidir = component_updatedir(sysroot_path, self); | ||
|
||
if ostreebootdir.exists() { | ||
// New EFI dir /usr/lib/efi |
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.
Do you know if this this specific to the new Fedora grub/shim packages? I suspect it is...we may want to somehow make this a build time or even runtime conditional so in theory it's more pluggable/controllable by others.
I'd at least factor it out into a const
somewhere that explains where it came from.
Hmm actually, this topic also strongly relates to #766 right?
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.
Thank you so much for the reviewing!
Do you know if this this specific to the new Fedora grub/shim packages? I suspect it is...we may want to somehow make this a build time or even runtime conditional so in theory it's more pluggable/controllable by others.
Yes.
I'd at least factor it out into a
const
somewhere that explains where it came from.
SGTM.
Hmm actually, this topic also strongly relates to #766 right?
Actually this is related to issue #926 (comment), but we can extend it support #766 too.
Ok(acc) | ||
}); | ||
packagesystem::query_files(sysroot_path, all_files?.into_iter())? | ||
} else if ostreebootdir.exists() { |
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.
Would it be cleaner perhaps if we checked first for ostreebootdir
, and migrated it to usr/lib/efi
if that doesn't exist? It should be an error if both exist.
Then we get closer to thinking of the ostreebootdir
one as legacy.
}) | ||
.collect::<Vec<String>>(); | ||
|
||
Command::new("mv") |
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 we have an opportunity here to make usr/lib/efi
the standard path actually if it exists, maybe we could make things as simple as the equivalent of ln -sr /usr/lib/efi /usr/lib/bootupd/updates/EFI
?
EDIT: Ah I see it's not that simple based on find_all_efi_dirs
.
Hmmm...but actually I like the idea of that layout, what if we tried to adopt that as the standard and migrate our current EFI layout to it? (It'd break updates for older bootupd though...without having dual layouts for a while, ug)
@@ -615,6 +656,29 @@ fn find_file_recursive<P: AsRef<Path>>(dir: P, target_file: &str) -> Result<Vec< | |||
Ok(result) | |||
} | |||
|
|||
// Find EFI dirs under usr/lib/efi | |||
// for exmaple: usr/lib/efi/shim/15.8-4/EFI, usr/lib/efi/grub2/2.12-34.fc42/EFI | |||
fn find_all_efi_dirs(sysroot_lib: &Path) -> Result<Vec<PathBuf>> { |
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.
BTW looking at this layout, I think we can now avoid invoking rpm
to query the file information for these which would be a huge side benefit.
So again I think this relates to #766 in that perhaps we make this layout our new "API" for adding content in the ESP?
Actually thinking about things here...you know, it probably wouldn't be terribly hard to change what rpm-ostree does to automatically do this instead (via an opt-in). That'd require some coordination but the powerful benefit is we'd effectively automatically "backport" support for /usr/lib/efi
even for older OSes which seems like it'd help us a lot here.
In
generate-update-metadata()
, checksusr/lib/efi/(shim|grub)/%{version}-%{release}/EFI/
first forEFI path, for example:
usr/lib/efi/shim/1.2-3/EFI/BOOT/
.If the path
usr/lib/efi
doesn’t exist, falls back to the legacyOSTree location
usr/lib/ostree-boot/efi/EFI/
.Then move existing EFI path to the
usr/lib/bootupd/updates/
.See #926
ci: add testing
generate-update-metadata
in bootc containerThanks Colin's PR #936