Skip to content

Commit

Permalink
layout/blspec.py: also clean-up UKI's with 'gentoo' prefix
Browse files Browse the repository at this point in the history
With version 8 installkernel-gentoo gains an optional plugin to install UKIs
to the usual location at ${ESP}/EFI/Linux (i.e. BLS type 2 layout). This
is useful for boot loaders such as systemd-boot that auto discover UKIs at
this location, as well as for EFI stub booting where it is required to have
the UKI on the ESP (which is not necessarily mounted at /boot).

Because the entry-token that is the usual prefix for these UKIs is specific
to systemd and kernel-install (i.e. installkernel-systemd), installkernel-gentoo
prefixes the UKIs with 'gentoo' instead. The changes here ensure that eclean-
kernel recognizes these UKIs as ours and cleans them up as well.

Signed-off-by: Andrew Ammerlaan <[email protected]>
  • Loading branch information
Nowa-Ammerlaan committed Nov 30, 2023
1 parent 53eadd0 commit 975ae50
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ecleankernel/layout/blspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,18 @@ def find_kernels(self,
# collect from ESP/Linux
if self.ukidir.is_dir():
for file in os.listdir(self.ukidir):
if (not file.startswith(self.kernel_id) or
not file.endswith(".efi")):
# This file is not an efi file or does not belong to us
if not file.endswith(".efi"):
# Not an UKI
continue
ver = file.removeprefix(self.kernel_id +
if file.startswith(self.kernel_id):
prefix = self.kernel_id
elif file.startswith("gentoo"):
prefix = "gentoo"
else:
# Not our UKI
continue

ver = file.removeprefix(prefix +
"-").removesuffix(".efi")

kernels[(ver, "uki")] = self.append_kernel_files(
Expand Down

0 comments on commit 975ae50

Please sign in to comment.