diff --git a/ecleankernel/layout/std.py b/ecleankernel/layout/std.py index 5e44091..6362249 100644 --- a/ecleankernel/layout/std.py +++ b/ecleankernel/layout/std.py @@ -47,6 +47,9 @@ class StdLayout(ModuleDirLayout): '.gz', '.lz', '.xz', + + # efistub + '.efi', ] def find_kernels(self, @@ -63,54 +66,56 @@ def find_kernels(self, # collect from /boot kernels: typing.Dict[str, typing.Dict[str, Kernel]] = {} other_files: typing.List[typing.Tuple[GenericFile, str]] = [] - boot_directory = self.root / 'boot' - try: - diter = os.listdir(boot_directory) - except FileNotFoundError: - pass - else: - for fn in diter: - # skip hidden and GRUB signature files - if fn.startswith('.') or fn.endswith('.sig'): - continue - path = boot_directory / fn - if path.is_symlink() or not path.is_file(): - continue - # skip unversioned files - ver = fn.partition('-')[2] - if not ver: - continue - - # strip suffix from filename to get the correct version - for suffix in self.suffixes: - if ver.endswith(suffix): - ver = ver[:-len(suffix)] - break - elif ver.endswith(suffix + '.old'): - ver = ver[:-len(suffix)-4] + '.old' - - # try recognizing kernel image via magic - try: - kobj = KernelImage(path) - except UnrecognizedKernelError: - # fall back to filename - for ftype, prefix in self.prefixes: - if ftype not in exclusions: - if fn.startswith(prefix): - other_files.append( - (GenericFile(path, ftype), ver)) - break - continue - - # the following is done only for kernel images - assert isinstance(kobj, KernelImage) - kg = kernels.setdefault(ver, {}) - k = kg.setdefault(kobj.internal_version, Kernel(ver)) - k.all_files.append(kobj) - - # associate the module directory - k.all_files.extend( - module_dict.get(kobj.internal_version, [])) + for boot_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': + try: + diter = os.listdir(boot_directory) + except FileNotFoundError: + continue + else: + for fn in diter: + # skip hidden and GRUB signature files + if fn.startswith('.') or fn.endswith('.sig'): + continue + path = boot_directory / fn + if path.is_symlink() or not path.is_file(): + continue + # skip unversioned files + ver = fn.partition('-')[2] + if not ver: + continue + + # strip suffix from filename to get the correct version + for suffix in self.suffixes: + if ver.endswith(suffix): + ver = ver[:-len(suffix)] + break + elif ver.endswith(suffix + '.old'): + ver = ver[:-len(suffix)-4] + '.old' + + # try recognizing kernel image via magic + try: + kobj = KernelImage(path) + except UnrecognizedKernelError: + # fall back to filename + for ftype, prefix in self.prefixes: + if ftype not in exclusions: + if fn.startswith(prefix): + other_files.append( + (GenericFile(path, ftype), ver)) + break + continue + + # the following is done only for kernel images + assert isinstance(kobj, KernelImage) + kg = kernels.setdefault(ver, {}) + k = kg.setdefault(kobj.internal_version, Kernel(ver)) + k.all_files.append(kobj) + + # associate the module directory + k.all_files.extend( + module_dict.get(kobj.internal_version, [])) # merge other files into kernel groups for fobj, ver in other_files: