nixos/systemd-boot: decrease catch scope for ValueError

Changed files
+7 -7
nixos
modules
system
boot
loader
+7 -7
nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
···
known_paths.append(copy_from_profile(*gen, "kernel", True))
known_paths.append(copy_from_profile(*gen, "initrd", True))
for path in glob.iglob("@efiSysMountPoint@/loader/entries/nixos*-generation-[1-9]*.conf"):
+
if rex_profile.match(path):
+
prof = rex_profile.sub(r"\1", path)
+
else:
+
prof = None
try:
-
if rex_profile.match(path):
-
prof = rex_profile.sub(r"\1", path)
-
else:
-
prof = None
gen_number = int(rex_generation.sub(r"\1", path))
-
if not (prof, gen_number, None) in gens:
-
os.unlink(path)
except ValueError:
-
pass
+
continue
+
if not (prof, gen_number, None) in gens:
+
os.unlink(path)
for path in glob.iglob("@efiSysMountPoint@/efi/nixos/*"):
if not path in known_paths and not os.path.isdir(path):
os.unlink(path)