Skip to content

Commit

Permalink
layout/blspec.py: consider bls named after ID from os-release
Browse files Browse the repository at this point in the history
OpenRC machines are not guaranteed to have the machine-id

Closes: #55
Signed-off-by: Andrew Ammerlaan <[email protected]>
  • Loading branch information
Nowa-Ammerlaan committed Oct 5, 2024
1 parent 55aa5e8 commit 617c304
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ecleankernel/layout/blspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def __init__(self,
root: Path
) -> None:
super().__init__(root)
# TODO: according to bootctl(1), we should fall back to IMAGE_ID=
# and then ID= from os-release

distro_id = distro.id() or "linux"

for path in ("etc/kernel/entry-token", "etc/machine-id"):
try:
with open(root / path) as f:
Expand All @@ -51,7 +52,7 @@ def __init__(self,
except FileNotFoundError:
pass
else:
raise LayoutNotFound("/etc/machine-id not found")
self.kernel_id = distro_id

for d in self.potential_dirs:
# Present if type 1
Expand Down Expand Up @@ -137,8 +138,6 @@ def find_kernels(self,
# Not an UKI
continue

distro_id = distro.id() or "linux"

ver = basename.removeprefix(f"{self.kernel_id}-"
).removeprefix(f"{distro_id}-")
if basename == ver:
Expand Down

0 comments on commit 617c304

Please sign in to comment.