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]>
Closes: #56
Signed-off-by: Michał Górny <[email protected]>
  • Loading branch information
Nowa-Ammerlaan authored and mgorny committed Oct 27, 2024
1 parent b8ae875 commit f1ab67e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 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

self.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 = self.distro_id

for d in self.potential_dirs:
# Present if type 1
Expand Down Expand Up @@ -137,10 +138,9 @@ 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}-")
).removeprefix(f"{self.distro_id}-"
)
if basename == ver:
# Not our UKI
continue
Expand Down

0 comments on commit f1ab67e

Please sign in to comment.