state.root.joinpath("var/lib/pacman").mkdir(mode=0o755, exist_ok=True, parents=True)
config = state.pkgmngr / "etc/pacman.conf"
+ if config.exists():
+ return
+
config.parent.mkdir(mode=0o755, exist_ok=True, parents=True)
with config.open("w") as f:
state.root.joinpath("var/lib/dpkg/status").touch()
config = state.pkgmngr / "etc/apt/apt.conf"
-
- # Anything that users can override with dropins is written into the config file.
- config.write_text(
- dedent(
- """\
- APT::Install-Recommends "false";
- """
+ if not config.exists():
+ # Anything that users can override with dropins is written into the config file.
+ config.write_text(
+ dedent(
+ """\
+ APT::Install-Recommends "false";
+ """
+ )
)
- )
- sources = state.pkgmngr.joinpath("etc/apt/sources.list")
+ sources = state.pkgmngr / "etc/apt/sources.list"
if not sources.exists():
with sources.open("w") as f:
for repo in repos:
def setup_dnf(state: MkosiState, repos: Sequence[Repo]) -> None:
- state.pkgmngr.joinpath("etc/dnf").mkdir(exist_ok=True, parents=True)
- with state.pkgmngr.joinpath("etc/dnf/dnf.conf").open("w") as f:
+ config = state.pkgmngr / "etc/dnf/dnf.conf"
+
+ if config.exists():
+ return
+
+ config.parent.mkdir(exist_ok=True, parents=True)
+
+ with config.open("w") as f:
for repo in repos:
f.write(
dedent(