if not args.output_format.is_disk():
die("Sorry, can't boot non-disk images with qemu.")
+ if needs_build(args) and args.verb == "qemu" and not args.bootable:
+ die("Images built without the --bootable option cannot be booted using qemu")
+
if needs_build(args) and args.qemu_headless and not args.bootable:
die("--qemu-headless requires --bootable")
def needs_build(args: Union[argparse.Namespace, MkosiArgs]) -> bool:
- return args.verb == "build" or (not args.output.exists() and args.verb in MKOSI_COMMANDS_NEED_BUILD)
+ return args.verb == "build" or (not args.output.exists() and args.verb in MKOSI_COMMANDS_NEED_BUILD) or args.force > 0
def run_verb(raw: argparse.Namespace) -> None:
assert parse(["build"]).verb == "build"
assert parse(["shell"]).verb == "shell"
assert parse(["boot"]).verb == "boot"
- assert parse(["qemu"]).verb == "qemu"
+ assert parse(["--bootable", "qemu"]).verb == "qemu"
with pytest.raises(SystemExit):
parse(["invalid"])