]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Revert 9f4d174daac954aaa9e18ee9bb58c6d7a946ec9d
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 6 Mar 2025 11:18:59 +0000 (12:18 +0100)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Thu, 6 Mar 2025 12:16:12 +0000 (13:16 +0100)
The declarative package pulls in perl which is not ideal, let's
switch back to the previous approach.

mkosi/distributions/debian.py
mkosi/installer/apt.py

index dfa4413eba6f7ecff60987e5b2300977ea6cdfb9..1b09fc45729deb078b9c5a32d4fc002ac0dab540 100644 (file)
@@ -144,13 +144,6 @@ class Installer(DistributionInstaller):
                     f"-oDPkg::Pre-Install-Pkgs::=cat >{workdir(Path(f.name))}",
                     "?essential",
                     "base-files",
-                    # Debian policy is to start daemons by default. The policy-rc.d script can be used choose
-                    # which ones to start. Let's install the necessary packages to deny all daemon startups.
-                    # Instead, systemd presets should be used to decide which daemons are enabled and which
-                    # are not. See https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt for
-                    # more information.
-                    "policy-rcd-declarative",
-                    "policy-rcd-declarative-deny-all",
                 ],
                 options=["--bind", f.name, workdir(Path(f.name))],
             )
index d53bb83bf27e025826f0acf0d383e577f3d3460d..becb6d38e648bf8be5ef47669f757f52f2f0fd62 100644 (file)
@@ -237,8 +237,21 @@ class Apt(PackageManager):
         *,
         apivfs: bool = True,
     ) -> None:
+        # Debian policy is to start daemons by default. The policy-rc.d script can be used choose which ones
+        # to start. Let's install one that denies all daemon startups.
+        # See https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt for more information.
+        # Note: despite writing in /usr/sbin, this file is not shipped by the OS and instead should be
+        # managed by the admin.
+        policyrcd = context.root / "usr/sbin/policy-rc.d"
+        with umask(~0o755):
+            policyrcd.parent.mkdir(parents=True, exist_ok=True)
+        with umask(~0o644):
+            policyrcd.write_text("#!/bin/sh\nexit 101\n")
+
         cls.invoke(context, "install", packages, apivfs=apivfs)
 
+        policyrcd.unlink()
+
         # systemd-gpt-auto-generator is disabled by default in Ubuntu:
         # https://git.launchpad.net/ubuntu/+source/systemd/tree/debian/systemd.links?h=ubuntu/noble-proposed.
         # Let's make sure it is enabled by default in our images.