]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Only install basic filesystem package by default
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 6 Apr 2023 09:27:24 +0000 (11:27 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 12 Apr 2023 13:12:12 +0000 (15:12 +0200)
Let's trim down on the default packages we install, and only install
the most basic filesystem package by default. We'll leave everything
else up to the user.

This change is important when considering mkosi's use to build system
extensions and similar, where even the default packages we have now
are too much.

NEWS.md
mkosi/distributions/arch.py
mkosi/distributions/centos.py
mkosi/distributions/debian.py
mkosi/distributions/fedora.py
mkosi/distributions/mageia.py
mkosi/distributions/openmandriva.py
mkosi/distributions/opensuse.py
mkosi/distributions/ubuntu.py

diff --git a/NEWS.md b/NEWS.md
index 7e38962879ff06860d919b17779e3f8d60f93bb7..7a09833a5ab2b344b5541ceb651d16e30b642c93 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
   runtime. Use the new `--qemu-gui` option to start qemu in its graphical interface.
 - Removed `--netdev`. Can be replaced by manually installing systemd-networkd, putting a network file in the
   image and enabling systemd-networkd.
-- If `mkosi.extra/` exists, it is now always used instead of only when no explicit extra trees are defined.
+- If `mkosi.extra/` or `mkosi.skeleton/` exist, they are now always used instead of only when no explicit
+  extra/skeleton trees are defined.
+- mkosi doesn't install any default packages anymore aside from the base filesystem layout package. In
+  practice, this means systemd and other basic tools have to be installed explicitly from now on.
 - Removed `--qcow2` option in favor of supporting only raw disk images as the disk image output format.
 - Removed `--bmap` option as it can be trivially added manually by utilizing a finalize script.
 - The `never` value for `--with-network` was spun of into its own custom option `--cache-only`.
index 71859dbab4576b8ea48d441127fe82ffad194533..02a19e739a20ccdcd93e202392250981f6a7a5cc 100644 (file)
@@ -87,7 +87,7 @@ def install_arch(state: MkosiState) -> None:
             f.write(f"Include = {d}/*\n")
 
     packages = state.config.packages.copy()
-    add_packages(state.config, packages, "base")
+    add_packages(state.config, packages, "filesystem")
 
     if state.config.bootable and not state.config.initrds:
         add_packages(state.config, packages, "dracut")
index f1f05eb0dccff3a87dc6d2d6013e79ee83d9c32a..43260c74fcd12c12b7e64dcc49cce26af17ac3ba 100644 (file)
@@ -95,7 +95,7 @@ class CentosInstaller(DistributionInstaller):
             env = {}
 
         packages = state.config.packages.copy()
-        add_packages(state.config, packages, "systemd", "rpm")
+        add_packages(state.config, packages, "filesystem")
         if state.config.bootable:
             add_packages(state.config, packages, "kernel")
             if not state.config.initrds:
@@ -106,14 +106,6 @@ class CentosInstaller(DistributionInstaller):
         if state.config.ssh:
             add_packages(state.config, packages, "openssh-server")
 
-        if "epel" in state.config.repositories:
-            add_packages(state.config, packages, "epel-release")
-
-        # Make sure we only install the minimal language files by default on CentOS Stream 8 which still
-        # defaults to all langpacks.
-        if release <= 8:
-            add_packages(state.config, packages, "glibc-minimal-langpack")
-
         invoke_dnf(state, "install", packages, env)
 
         syslog = state.root.joinpath("etc/systemd/system/syslog.service")
index f03b5a1a010a9eb256d6c84213871da5358c6d28..50e4dc2340c739a592112b6dc7093c46e984087f 100644 (file)
@@ -25,14 +25,6 @@ class DebianInstaller(DistributionInstaller):
         if not any(package.startswith("linux-image") for package in packages):
             add_packages(state.config, packages, f"linux-image-{DEBIAN_KERNEL_ARCHITECTURES[state.config.architecture]}")
 
-    @classmethod
-    def _fixup_resolved(cls, state: MkosiState, packages: list[str]) -> None:
-        if "systemd" in packages and "systemd-resolved" not in packages:
-            # The default resolv.conf points to 127.0.0.1, and resolved is disabled, fix it in
-            # the base image.
-            state.root.joinpath("etc/resolv.conf").unlink(missing_ok=True)
-            state.root.joinpath("etc/resolv.conf").symlink_to("../run/systemd/resolve/resolv.conf")
-
     @classmethod
     def filesystem(cls) -> str:
         return "ext4"
@@ -90,7 +82,7 @@ class DebianInstaller(DistributionInstaller):
         # conflicts. dbus and libpam-systemd are optional dependencies for systemd in debian so we include them
         # explicitly.
         packages = state.config.packages.copy()
-        add_packages(state.config, packages, "systemd", "systemd-sysv", "dbus", "libpam-systemd")
+        add_packages(state.config, packages, "base-files")
 
         if state.config.bootable:
             if not state.config.initrds:
@@ -155,9 +147,6 @@ class DebianInstaller(DistributionInstaller):
         if state.config.bootable:
             add_apt_package_if_exists(state, packages, "systemd-boot")
 
-        # systemd-resolved was split into a separate package
-        add_apt_package_if_exists(state, packages, "systemd-resolved")
-
         invoke_apt(state, "get", "install", ["--assume-yes", "--no-install-recommends", *packages])
 
         # Now clean up and add the real repositories, so that the image is ready
@@ -173,8 +162,6 @@ class DebianInstaller(DistributionInstaller):
             # Don't ship dpkg config files in extensions, they belong with dpkg in the base image.
             dpkg_nodoc_conf.unlink() # type: ignore
 
-        cls._fixup_resolved(state, packages)
-
         # Debian/Ubuntu use a different path to store the locale so let's make sure that path is a symlink to
         # etc/locale.conf.
         state.root.joinpath("etc/default/locale").unlink(missing_ok=True)
index 15d8fa95268c647c4e71ac1932b42b45803bebf3..df9c46e48ae285f548941aee4bad7de8b316326c 100644 (file)
@@ -97,7 +97,7 @@ def install_fedora(state: MkosiState) -> None:
     setup_dnf(state, repos)
 
     packages = state.config.packages.copy()
-    add_packages(state.config, packages, "systemd", "util-linux", "rpm")
+    add_packages(state.config, packages, "filesystem")
 
     if state.config.bootable:
         add_packages(state.config, packages, "kernel-core", "kernel-modules")
index e82257b2360d0d021478039e61ec27ee805eb24d..597556d043f40843a5b1e63390d9728409c4711e 100644 (file)
@@ -58,7 +58,7 @@ def install_mageia(state: MkosiState) -> None:
     setup_dnf(state, repos)
 
     packages = state.config.packages.copy()
-    add_packages(state.config, packages, "basesystem-minimal", "dnf")
+    add_packages(state.config, packages, "filesystem")
     if state.config.bootable and not state.config.initrds:
         add_packages(state.config, packages, "dracut")
         # Mageia ships /etc/50-mageia.conf that omits systemd from the initramfs and disables hostonly.
index 08a0ab1ece81b8576cfbdbe02d72551fb4d8b9a8..987038fc047ab784d59fef675b48bb96741137bd 100644 (file)
@@ -60,7 +60,7 @@ def install_openmandriva(state: MkosiState) -> None:
 
     packages = state.config.packages.copy()
     # well we may use basesystem here, but that pulls lot of stuff
-    add_packages(state.config, packages, "basesystem-minimal", "systemd", "dnf")
+    add_packages(state.config, packages, "filesystem")
     if state.config.bootable:
         add_packages(state.config, packages, "systemd-boot", "systemd-cryptsetup", conditional="systemd")
         add_packages(state.config, packages, "kernel-release-server", "timezone")
index 3f92f882a4f8831ef11ac1c58c2191aacedbb02d..5710907acfc7f3c1e7ed81513270f406bf0f19cb 100644 (file)
@@ -169,12 +169,7 @@ def install_opensuse(state: MkosiState) -> None:
     packages = state.config.packages.copy()
 
     if state.config.base_image is None:
-        add_packages(state.config, packages, "systemd", "glibc-locale-base", "zypper")
-
-        if state.config.release.startswith("42."):
-            add_packages(state.config, packages, "patterns-openSUSE-minimal_base")
-        else:
-            add_packages(state.config, packages, "patterns-base-minimal_base")
+        add_packages(state.config, packages, "filesystem")
 
         if state.config.bootable:
             add_packages(state.config, packages, "kernel-default")
index 09303879aa387528641a837cf5f7a56fe0e4ec09..6b49418d7adb5ac1f7e71f7a3dcf1c6a43aa8fa7 100644 (file)
@@ -31,7 +31,3 @@ class UbuntuInstaller(DebianInstaller):
             security = f"deb http://ports.ubuntu.com/ {state.config.release}-security {' '.join(repos)}"
 
         state.root.joinpath(f"etc/apt/sources.list.d/{state.config.release}-security.list").write_text(f"{security}\n")
-
-    @classmethod
-    def _fixup_resolved(cls, state: MkosiState, packages: Sequence[str]) -> None:
-        pass