From: Daan De Meyer Date: Wed, 4 Oct 2023 08:41:41 +0000 (+0200) Subject: Rename "none" distribution to "custom" X-Git-Tag: v18~12^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45344020f0ef44bb8fc0fe5b47f6c2a7c734378c;p=thirdparty%2Fmkosi.git Rename "none" distribution to "custom" "custom" seems a better fit than "none" since there likely still is a distribution, we just don't support it. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 9beab92b2..5ae38f1fa 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -986,8 +986,8 @@ def build_initrd(state: MkosiState) -> Path: if symlink.exists(): return symlink.resolve() - if state.config.distribution == Distribution.none: - die(f"Building a default initrd is not supported with distribution {state.config.distribution}") + if state.config.distribution == Distribution.custom: + die("Building a default initrd is not supported for custom distributions") # Default values are assigned via the parser so we go via the argument parser to construct # the config for the initrd. diff --git a/mkosi/config.py b/mkosi/config.py index 9645ee71e..6150a0db1 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -298,9 +298,9 @@ def config_default_distribution(namespace: argparse.Namespace) -> Distribution: if not detected: logging.info( "Distribution of your host can't be detected or isn't a supported target. " - "Defaulting to Distribution=none." + "Defaulting to Distribution=custom." ) - return Distribution.none + return Distribution.custom return detected diff --git a/mkosi/distributions/__init__.py b/mkosi/distributions/__init__.py index b33334d4f..8169983ae 100644 --- a/mkosi/distributions/__init__.py +++ b/mkosi/distributions/__init__.py @@ -72,7 +72,6 @@ class DistributionInstaller: class Distribution(StrEnum): - none = enum.auto() fedora = enum.auto() debian = enum.auto() ubuntu = enum.auto() @@ -85,6 +84,7 @@ class Distribution(StrEnum): rocky = enum.auto() alma = enum.auto() gentoo = enum.auto() + custom = enum.auto() def is_centos_variant(self) -> bool: return self in (Distribution.centos, Distribution.alma, Distribution.rocky) diff --git a/mkosi/distributions/none.py b/mkosi/distributions/custom.py similarity index 79% rename from mkosi/distributions/none.py rename to mkosi/distributions/custom.py index fced69ab3..37bbe3a90 100644 --- a/mkosi/distributions/none.py +++ b/mkosi/distributions/custom.py @@ -19,9 +19,9 @@ class Installer(DistributionInstaller): @classmethod def install_packages(cls, state: MkosiState, packages: Sequence[str]) -> None: if packages: - die("Installing packages is not supported with distribution 'none'") + die("Installing packages is not supported for custom distributions'") @classmethod def remove_packages(cls, state: MkosiState, packages: Sequence[str]) -> None: if packages: - die("Removing packages is not supported with distribution 'none'") + die("Removing packages is not supported for custom distributions") diff --git a/mkosi/resources/mkosi.md b/mkosi/resources/mkosi.md index e842399a0..22f0f9ac6 100644 --- a/mkosi/resources/mkosi.md +++ b/mkosi/resources/mkosi.md @@ -395,8 +395,9 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, : The distribution to install in the image. Takes one of the following arguments: `fedora`, `debian`, `ubuntu`, `arch`, `opensuse`, `mageia`, - `centos`, `rhel-ubi`, `openmandriva`, `rocky`, `alma`, `none`. - If not specified, defaults to the distribution of the host. + `centos`, `rhel-ubi`, `openmandriva`, `rocky`, `alma`, `custom`. + If not specified, defaults to the distribution of the host or `custom` + if the distribution of the host is not a supported distribution. `Release=`, `--release=`, `-r` @@ -1294,7 +1295,10 @@ any distribution that packages `apt` may be used to build *Debian* or *Ubuntu* i Any distribution that packages `dnf` may be used to build images for any of the rpm-based distributions. Any distro that packages `pacman` may be used to build *Arch Linux* images. Any distribution that packages `zypper` may be used to build *openSUSE* images. -Other distributions and build automation tools for embedded Linux systems such as Buildroot, OpenEmbedded and Yocto Project may be used by selecting the `none` distribution, and populating the rootfs via a combination of base trees, skeleton trees, and prepare scripts. +Other distributions and build automation tools for embedded Linux +systems such as Buildroot, OpenEmbedded and Yocto Project may be used by +selecting the `custom` distribution, and populating the rootfs via a +combination of base trees, skeleton trees, and prepare scripts. Currently, *Fedora Linux* packages all relevant tools as of Fedora 28.