flash: add write-efi-boot-entries flag

This commit is contained in:
Jörg Thalheim 2024-05-29 09:18:05 +02:00
parent 2ae50b7398
commit 96746b7c98

View File

@ -85,6 +85,7 @@ def flash_machine(
disks: dict[str, str],
system_config: dict[str, Any],
dry_run: bool,
write_efi_boot_entries: bool,
debug: bool,
extra_args: list[str] = [],
) -> None:
@ -113,6 +114,8 @@ def flash_machine(
disko_install.append("sudo")
disko_install.append("disko-install")
if write_efi_boot_entries:
disko_install.append("--write-efi-boot-entries")
if dry_run:
disko_install.append("--dry-run")
if debug:
@ -183,6 +186,7 @@ def flash_command(args: argparse.Namespace) -> None:
mode=args.mode,
language=args.lang,
keymap=args.keymap,
write_efi_boot_entries=args.write_efi_boot_entries,
nix_options=args.options,
)
@ -239,6 +243,8 @@ def flash_command(args: argparse.Namespace) -> None:
system_config=extra_config,
dry_run=opts.dry_run,
debug=opts.debug,
write_efi_boot_entries=opts.write_efi_boot_entries,
extra_args=opts.nix_options,
)
@ -301,4 +307,16 @@ def register_parser(parser: argparse.ArgumentParser) -> None:
default=False,
action="store_true",
)
parser.add_argument(
"--write-efi-boot-entries",
help=textwrap.dedent(
"""
Write EFI boot entries to the NVRAM of the system for the installed system.
Specify this option if you plan to boot from this disk on the current machine,
but not if you plan to move the disk to another machine.
"""
).strip(),
default=False,
action="store_true",
)
parser.set_defaults(func=flash_command)