]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
debian: Disable services in preset by default
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 7 Mar 2023 13:47:12 +0000 (14:47 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 7 Mar 2023 14:08:09 +0000 (15:08 +0100)
Let's not enable services by default unless explicitly enabled by
a previous preset file.

mkosi/distributions/debian.py

index 2d8f0d7b9eeb28dfb49dc069a120151dc101d80c..357d61b563f3410a10494e80b4e97bc3c97ca50b 100644 (file)
@@ -191,6 +191,12 @@ class DebianInstaller(DistributionInstaller):
         state.root.joinpath("etc/default/locale").unlink(missing_ok=True)
         state.root.joinpath("etc/default/locale").symlink_to("../locale.conf")
 
+        # Don't enable any services by default.
+        if not state.do_run_build_script:
+            presetdir = state.root / "etc/systemd/system-preset"
+            presetdir.mkdir(exist_ok=True, mode=0o755)
+            presetdir.joinpath("99-mkosi-disable.preset").write_text("disable *")
+
     @classmethod
     def install_packages(cls, state: MkosiState, packages: Sequence[str]) -> None:
         invoke_apt(state, "get", "install", ["--assume-yes", "--no-install-recommends", *packages])