# SPDX-License-Identifier: LGPL-2.1+
-import os
from pathlib import Path
from mkosi.config import ConfigFeature
mounts: list[PathString] = [
*(["--ro-bind", m, m] if (m := context.config.local_mirror) else []),
- *(["--ro-bind", os.fspath(p), os.fspath(p)] if (p := context.workspace / "apt.conf").exists() else []),
*finalize_crypto_mounts(tools=context.config.tools()),
"--bind", context.packages, "/work/packages",
]
(context.cache_dir / "lib/apt").mkdir(exist_ok=True, parents=True)
(context.cache_dir / "cache/apt").mkdir(exist_ok=True, parents=True)
- # We have a special apt.conf outside of pkgmngr dir that only configures "Dir::Etc" that we pass to APT_CONFIG to
- # tell apt it should read config files from /etc/apt in case this is overridden by distributions. This is required
+ # We have a special apt.conf outside of /etc/apt that only configures "Dir::Etc" that we pass to APT_CONFIG to tell
+ # apt it should read config files from /etc/apt in case this is overridden by distributions. This is required
# because apt parses CLI configuration options after parsing its configuration files and as such we can't use CLI
# options to tell apt where to look for configuration files.
- config = context.workspace / "apt.conf"
+ config = context.pkgmngr / "etc/apt.conf"
if not config.exists():
config.write_text(
textwrap.dedent(
cmdline: list[PathString] = [
"env",
- f"APT_CONFIG={context.workspace / 'apt.conf'}",
+ "APT_CONFIG=/etc/apt.conf",
"DEBIAN_FRONTEND=noninteractive",
"DEBCONF_INTERACTIVE_SEEN=true",
"INITRD=No",