]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Always mount in /usr/share/factory from the host in relaxed sandbox
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 2 Nov 2024 17:55:51 +0000 (18:55 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 3 Nov 2024 09:41:27 +0000 (10:41 +0100)
If we're using /etc from the host, also use /usr/share/factory from
the host to account for symlinks from /etc into /usr/share/factory.

mkosi/run.py

index 7dbeba096ed5cb3d0e2638b3fb7da38de5bac1cd..549f076a4680f0c701dd9309fac303cf635e7839 100644 (file)
@@ -537,6 +537,11 @@ def sandbox_cmd(
                 else:
                     cmdline += ["--bind", p, p]
 
+            # /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():
+                cmdline += ["--bind", factory, factory]
+
         if home := current_home_dir():
             cmdline += ["--bind", home, home]
     else: