From: Daan De Meyer Date: Mon, 7 Apr 2025 10:33:22 +0000 (+0200) Subject: debian: Remove check if apt exists from install_apt_sources() X-Git-Tag: v26~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44c7e1fadc957375cd44dae4e20ea260c4267f88;p=thirdparty%2Fmkosi.git debian: Remove check if apt exists from install_apt_sources() We now install the apt sources before we install apt into the image so this check can never succeed so let's drop it. At the same time, create parent directories if needed and make sure we use the proper modes. --- diff --git a/mkosi/distributions/debian.py b/mkosi/distributions/debian.py index 7dfad1398..1a588d409 100644 --- a/mkosi/distributions/debian.py +++ b/mkosi/distributions/debian.py @@ -219,12 +219,11 @@ class Installer(DistributionInstaller): def install_apt_sources(context: Context, repos: Iterable[AptRepository]) -> None: - if not (context.root / "usr/bin/apt").exists(): - return - sources = context.root / f"etc/apt/sources.list.d/{context.config.release}.sources" if not sources.exists(): - with sources.open("w") as f: + with umask(~0o755): + sources.parent.mkdir(parents=True, exist_ok=True) + with umask(~0o644), sources.open("w") as f: for repo in repos: f.write(str(repo))