From: Daan De Meyer Date: Mon, 14 Aug 2023 18:57:30 +0000 (+0200) Subject: Make sure we pass through TMPDIR to run() X-Git-Tag: v16~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bfe1569bd574cd246295b97ba0a41b39f5bac88;p=thirdparty%2Fmkosi.git Make sure we pass through TMPDIR to run() --- diff --git a/mkosi/installer/apt.py b/mkosi/installer/apt.py index d84a71a6b..c8804326c 100644 --- a/mkosi/installer/apt.py +++ b/mkosi/installer/apt.py @@ -107,5 +107,6 @@ def invoke_apt( ) -> None: cmd = apivfs_cmd(state.root) if apivfs else [] bwrap(cmd + apt_cmd(state, command) + [operation, *sort_packages(packages)], - options=flatten(["--bind", d, d] for d in (state.config.workspace_dir, state.config.cache_dir) if d), + # dpkg doesn't seem to unset TMPDIR when chrooting so we unset it for dpkg. + options=["--unsetenv", "TMPDIR"] + flatten(["--bind", d, d] for d in (state.config.workspace_dir, state.config.cache_dir) if d), network=True, env=state.config.environment) diff --git a/mkosi/run.py b/mkosi/run.py index 96290b5ae..5efa29015 100644 --- a/mkosi/run.py +++ b/mkosi/run.py @@ -180,6 +180,9 @@ def run( LANG="C.UTF-8", ) | env + if "TMPDIR" in os.environ: + env["TMPDIR"] = os.environ["TMPDIR"] + if ARG_DEBUG.get(): env["SYSTEMD_LOG_LEVEL"] = "debug" @@ -391,6 +394,7 @@ def chroot_cmd(root: Path, *, options: Sequence[PathString] = ()) -> list[PathSt "--setenv", "container", "mkosi", "--setenv", "HOME", "/", "--setenv", "PATH", "/usr/bin:/usr/sbin", + "--unsetenv", "TMPDIR", ] resolve = Path("etc/resolv.conf")