]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix disk image check
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 Jul 2024 19:58:02 +0000 (21:58 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 Jul 2024 20:04:29 +0000 (22:04 +0200)
mkosi/__init__.py

index fdfaa99be80cabc75edb787fde9978913104dbc5..95997ea3e9045a5bc01a208c93a7fd6de560712f 100644 (file)
@@ -2787,7 +2787,7 @@ def check_inputs(config: Config) -> None:
         if not base.exists():
             die(f"Base tree {base} not found")
 
-        if base.suffix == ".raw" and os.getuid() != 0:
+        if base.is_file() and base.suffix == ".raw" and os.getuid() != 0:
             die("Must run as root to use disk images in base trees")
 
     if config.tools_tree and not config.tools_tree.exists():
@@ -2800,7 +2800,7 @@ def check_inputs(config: Config) -> None:
             if not tree.source.exists():
                 die(f"{name.capitalize()} tree {tree.source} not found")
 
-            if tree.source.suffix == ".raw" and os.getuid() != 0:
+            if tree.source.is_file() and tree.source.suffix == ".raw" and not tree.target and os.getuid() != 0:
                 die(f"Must run as root to use disk images in {name} trees")
 
     if config.bootable != ConfigFeature.disabled: