-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ecleankernel/layout: do not hardcode os id/name
Signed-off-by: Andrew Ammerlaan <[email protected]>
- Loading branch information
1 parent
ee5f25b
commit 36d8754
Showing
5 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
# (c) 2020-2023 Michał Górny <[email protected]> | ||
# Released under the terms of the 2-clause BSD license. | ||
|
||
import distro | ||
import logging | ||
import os | ||
import typing | ||
|
@@ -138,8 +139,10 @@ def find_kernels(self, | |
# Not an UKI | ||
continue | ||
|
||
distro_id = distro.id() or 'linux' | ||
|
||
ver = basename.removeprefix(f"{self.kernel_id}-" | ||
).removeprefix("gentoo-") | ||
).removeprefix(f"{distro_id}-") | ||
if basename == ver: | ||
# Not our UKI | ||
continue | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
# (c) 2011-2020 Michał Górny <[email protected]> | ||
# Released under the terms of the 2-clause BSD license. | ||
|
||
import distro | ||
import itertools | ||
import os | ||
import os.path | ||
|
@@ -70,12 +71,14 @@ def find_kernels(self, | |
kernels: typing.Dict[str, typing.Dict[str, Kernel]] = {} | ||
other_files: typing.List[typing.Tuple[GenericFile, str]] = [] | ||
|
||
distro_name = distro.name() or 'Linux' | ||
|
||
def find_std_files() -> typing.Iterator: | ||
for directory in (self.root / 'boot', | ||
self.root / 'boot/EFI/EFI/Gentoo', | ||
self.root / 'boot/efi/EFI/Gentoo', | ||
self.root / 'boot/EFI/Gentoo', | ||
self.root / 'efi/EFI/Gentoo'): | ||
self.root / f"boot/EFI/EFI/{distro_name}", | ||
self.root / f"boot/efi/EFI/{distro_name}", | ||
self.root / f"boot/EFI/{distro_name}", | ||
self.root / f"efi/EFI/{distro_name}"): | ||
try: | ||
for file in os.listdir(directory): | ||
yield directory / file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters