]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
debian/ubuntu: Ignore apt config from the host system
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 29 Aug 2022 17:19:02 +0000 (19:19 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 29 Aug 2022 20:26:40 +0000 (22:26 +0200)
We only want to consider the apt config from the target system.
Because apt is rather inflexible and only parses the Dir option we
pass via the CLI after parsing all the config files from the host,
we have to resort to bind mounting an empty directory over /etc/apt
on the host to prevent it from reading configuration from there.

mkosi/__init__.py

index 6af6059c70dac7b6708d667366dc47e81caae012..5cd0e631c81059c46677d3c91a07076f6764b3fe 100644 (file)
@@ -2447,7 +2447,9 @@ def invoke_apt(
         INITRD="No",
     )
 
-    with mount_api_vfs(args, root):
+    # Overmount /etc/apt on the host with an empty directory, so that apt doesn't parse any configuration
+    # from it.
+    with mount_bind(workspace(root) / "apt", Path("/") / "etc/apt"), mount_api_vfs(args, root):
         return run(cmdline, env=env, text=True, **kwargs)