From 642323930effc0c520c66ff31d84e00d481f2813 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Fri, 7 Oct 2022 19:03:15 +0800 Subject: nixos/systemd-boot: correctly find gen_number for specialisation Before this patch, the gen_number found by regex contains "-specialisation-foo" if specialisation is used. As a result, applying int() to gen_number raises ValueError, causing entries containing a specialisation part not being removed. --- nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nixos/modules/system/boot/loader/systemd-boot') diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py index 5398ef6b84eb8..09e5e88ee022a 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py @@ -175,7 +175,7 @@ def get_specialisations(profile: Optional[str], generation: int, _: Optional[str def remove_old_entries(gens: List[SystemIdentifier]) -> None: rex_profile = re.compile("^@efiSysMountPoint@/loader/entries/nixos-(.*)-generation-.*\.conf$") - rex_generation = re.compile("^@efiSysMountPoint@/loader/entries/nixos.*-generation-(.*)\.conf$") + rex_generation = re.compile("^@efiSysMountPoint@/loader/entries/nixos.*-generation-([0-9]+)(-specialisation-.*)?\.conf$") known_paths = [] for gen in gens: known_paths.append(copy_from_profile(*gen, "kernel", True)) -- cgit 1.4.1