]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
sandbox: Only mount host dirs that exist
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 10:20:52 +0000 (11:20 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 10:20:52 +0000 (11:20 +0100)
mkosi/sandbox.py

index 150a07fd49777586e8adadac6d08fd456d20ccb2..2fcfdc10da709006fe18da4008f557f8e5195889 100644 (file)
@@ -104,7 +104,8 @@ def sandbox_cmd(
         dirs = ("/etc", "/opt", "/srv", "/media", "/mnt", "/var", os.fspath(INVOKING_USER.home()))
 
         for d in dirs:
-            cmdline += ["--bind", d, d]
+            if Path(d).exists():
+                cmdline += ["--bind", d, d]
 
         # `Path.parents` only supports slices and negative indexing from Python 3.10 onwards.
         # TODO: Remove list() when we depend on Python 3.10 or newer.