mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/systemd-boot: decrease catch scope for ValueError
This commit is contained in:
parent
437f73dd54
commit
42c9492829
1 changed files with 7 additions and 7 deletions
|
@ -181,16 +181,16 @@ def remove_old_entries(gens: List[SystemIdentifier]) -> None:
|
||||||
known_paths.append(copy_from_profile(*gen, "kernel", True))
|
known_paths.append(copy_from_profile(*gen, "kernel", True))
|
||||||
known_paths.append(copy_from_profile(*gen, "initrd", True))
|
known_paths.append(copy_from_profile(*gen, "initrd", True))
|
||||||
for path in glob.iglob("@efiSysMountPoint@/loader/entries/nixos*-generation-[1-9]*.conf"):
|
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:
|
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))
|
gen_number = int(rex_generation.sub(r"\1", path))
|
||||||
if not (prof, gen_number, None) in gens:
|
|
||||||
os.unlink(path)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
continue
|
||||||
|
if not (prof, gen_number, None) in gens:
|
||||||
|
os.unlink(path)
|
||||||
for path in glob.iglob("@efiSysMountPoint@/efi/nixos/*"):
|
for path in glob.iglob("@efiSysMountPoint@/efi/nixos/*"):
|
||||||
if not path in known_paths and not os.path.isdir(path):
|
if not path in known_paths and not os.path.isdir(path):
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue