]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Always use /var/tmp in apivfs_cmd()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 14:54:26 +0000 (15:54 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 17:57:54 +0000 (18:57 +0100)
apivfs_cmd() is always executed from within a sandbox so we can
just reuse the sandboxes /var/tmp.

mkosi/qemu.py
mkosi/sandbox.py

index 40d8b56cbbae82f86b1f9883af93bbd05da51bef..267df7f22fe3b282f9139251664354d419a29eb3 100644 (file)
@@ -746,7 +746,7 @@ def run_qemu(args: Args, config: Config) -> None:
             scratch = stack.enter_context(tempfile.NamedTemporaryFile(dir="/var/tmp", prefix="mkosi-scratch"))
             scratch.truncate(1024**4)
             run([f"mkfs.{config.distribution.filesystem()}", "-L", "scratch", scratch.name],
-                stdout=subprocess.DEVNULL, stderr=None, sandbox=config.sandbox())
+                stdout=subprocess.DEVNULL, sandbox=config.sandbox(options=["--bind", scratch.name, scratch.name]))
             cmdline += [
                 "-drive", f"if=none,id=scratch,file={scratch.name},format=raw",
                 "-device", "scsi-hd,drive=scratch",
index 0e5da6e45a8d029dae073aa6a22dd7db9f729b2d..1e730fdae863bf324fe96268c509ae0e02ef6403 100644 (file)
@@ -173,7 +173,7 @@ def apivfs_cmd(root: Path, *, tools: Path = Path("/")) -> list[PathString]:
         "--dev-bind", "/", "/",
         "--tmpfs", root / "run",
         "--tmpfs", root / "tmp",
-        "--bind", os.getenv("TMPDIR", "/var/tmp"), root / "var/tmp",
+        "--bind", "/var/tmp", root / "var/tmp",
         "--proc", root / "proc",
         "--dev", root / "dev",
         # APIVFS generally means chrooting is going to happen so unset TMPDIR just to be safe.