]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
burn: Fail if no arguments are provided
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 20 Dec 2024 14:12:06 +0000 (15:12 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 22 Dec 2024 22:46:06 +0000 (23:46 +0100)
If no arguments are provided systemd-repart will operate on the
device backing the rootfs which in the case of burn we definitely
don't want to do most of the time so let's fail unless a device is
explicitly provided.

mkosi/burn.py

index 07aacdc7969c69d486c06be8df5a51e88d095e89..24eee942f9650aba23bf0443fdf59ad35bddf4ed 100644 (file)
@@ -12,6 +12,9 @@ def run_burn(args: Args, config: Config) -> None:
     if config.output_format not in (OutputFormat.disk, OutputFormat.esp):
         die(f"{config.output_format} images cannot be burned to disk")
 
+    if not args.cmdline:
+        die("Please specify a device to burn the image to", hint="For example /dev/disk/by-id/usb-foobar")
+
     fname = config.output_dir_or_cwd() / config.output
 
     if len(args.cmdline) != 1: