]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Only mount /usr/share/factory if mount point exists in tools tree
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 12 Jan 2025 11:33:30 +0000 (12:33 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 13 Jan 2025 13:00:40 +0000 (14:00 +0100)
Otherwise the bind mount fails as the mount point cannot be created
since we mount /usr from the tools tree read-only.

mkosi/run.py

index f43d7f586ce6d2c5cf100f19b190e733df140dc7..02e0b78dc5d3ac4859dbf05460eac1657c2a67fa 100644 (file)
@@ -588,7 +588,11 @@ def sandbox_cmd(
 
             # /etc might be full of symlinks to /usr/share/factory, so make sure we use /usr/share/factory
             # from the host and not from the tools tree.
-            if tools != Path("/") and (factory := Path("/usr/share/factory")).exists():
+            if (
+                tools != Path("/")
+                and (tools / "usr/share/factory").exists()
+                and (factory := Path("/usr/share/factory")).exists()
+            ):
                 cmdline += ["--bind", factory, factory]
 
         if home := current_home_dir():