From 9b47e19addc049cc7f07eb66c941d21edea88592 Mon Sep 17 00:00:00 2001 From: Andrew Ammerlaan Date: Mon, 8 Apr 2024 19:51:45 +0200 Subject: [PATCH] blspec.py: clean-up type 2 (uki) also if no type 1 directory present On systems without systemd-boot we might still install and boot UKIs, with e.g. refind, or directly from firmware. On such systems the 'loader' directory (bls type 1) won't be present. Instead we only have the ESP/EFI/Linux directory (bls type 2), which we still want to clean-up. Signed-off-by: Andrew Ammerlaan --- ecleankernel/layout/blspec.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ecleankernel/layout/blspec.py b/ecleankernel/layout/blspec.py index f43ae29..69d4cde 100644 --- a/ecleankernel/layout/blspec.py +++ b/ecleankernel/layout/blspec.py @@ -53,14 +53,17 @@ def __init__(self, raise LayoutNotFound("/etc/machine-id not found") for d in self.potential_dirs: + # Present if type 1 bootloaderdir = root / d / "loader" - if bootloaderdir.is_dir(): + # Present if type 2 + ukidir = root / d / "EFI" / "Linux" + if bootloaderdir.is_dir() or ukidir.is_dir(): # Type 1 entries (linux+initrd) are in # $BOOT/ENTRY-TOKEN/KERNEL-VERSION/ self.blsdir = root / d / self.kernel_id # Type 2 entries (uki's) are in # $BOOT/EFI/Linux/ENTRY-TOKEN-KERNEL-VERSION.efi - self.ukidir = root / d / "EFI" / "Linux" + self.ukidir = ukidir return else: raise LayoutNotFound("/boot/[EFI/]loader not found")