]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
debian: Remove check if apt exists from install_apt_sources()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 7 Apr 2025 10:33:22 +0000 (12:33 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Tue, 8 Apr 2025 07:11:44 +0000 (09:11 +0200)
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.

mkosi/distributions/debian.py

index 7dfad139811ab0b96dbb8cf28d4f1d14ed5ea081..1a588d409c03166f51580c0d66ef582a3cbf569f 100644 (file)
@@ -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))