systemd-boot-builder: gracefully ignore errors during entry creation

Catch and ignore errors during writing of the boot entries.  These
errors could stem from profile names that are not valid filenames on
vfat filesystems.

fixes #114552
This commit is contained in:
Kai Harries 2021-02-28 11:45:03 +01:00
parent c1180834cf
commit e2be5dc1f4

View File

@ -222,9 +222,12 @@ def main():
gens += get_generations(profile) gens += get_generations(profile)
remove_old_entries(gens) remove_old_entries(gens)
for gen in gens: for gen in gens:
write_entry(*gen, machine_id) try:
if os.readlink(system_dir(*gen)) == args.default_config: write_entry(*gen, machine_id)
write_loader_conf(*gen) if os.readlink(system_dir(*gen)) == args.default_config:
write_loader_conf(*gen)
except OSError as e:
print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr)
memtest_entry_file = "@efiSysMountPoint@/loader/entries/memtest86.conf" memtest_entry_file = "@efiSysMountPoint@/loader/entries/memtest86.conf"
if os.path.exists(memtest_entry_file): if os.path.exists(memtest_entry_file):