From: Daan De Meyer Date: Sun, 6 Aug 2023 08:55:25 +0000 (+0200) Subject: Documentation and summary improvements X-Git-Tag: v15~28^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1744%2Fhead;p=thirdparty%2Fmkosi.git Documentation and summary improvements - Reorder config items in the summary to put more related stuff together - Add missing config items to the summary - Move Ssh= option to Content as it modifies the image - Move CacheOnly= option to Distribution - Document Passphrase= - Reorder documentation to match summary --- diff --git a/mkosi.md b/mkosi.md index 5158758ef..0172b7185 100644 --- a/mkosi.md +++ b/mkosi.md @@ -313,6 +313,36 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t distribution, or the version of the distribution running on the host if it matches the configured distribution. +`Architecture=`, `--architecture=` + +: The architecture to build the image for. A number of architectures can + be specified, but which ones are actually supported depends on the + distribution used and whether a bootable image is requested or not. + When building for a foreign architecture, you'll also need to install + and register a user mode emulator for that architecture. + + The following architectures can be specified: + + - alpha + - arc + - arm + - arm64 + - ia64 + - loongarch64 + - mips64-le + - mips-le + - parisc + - ppc + - ppc64 + - ppc64-le + - riscv32 + - riscv64 + - s390 + - s390x + - tilegx + - x86 + - x86-64 + `Mirror=`, `--mirror=`, `-m` : The mirror to use for downloading the distribution packages. Expects @@ -339,34 +369,12 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t : Enable package repositories that are disabled by default. This can be used to enable the EPEL repos for CentOS or different components of the Debian/Ubuntu repositories. -`Architecture=`, `--architecture=` - -: The architecture to build the image for. A number of architectures can be specified, but which ones are - actually supported depends on the distribution used and whether a bootable image is requested or not. When - building for a foreign architecture, you'll also need to install and register a user mode emulator for that - architecture. - - The following architectures can be specified: +`CacheOnly=`, `--cache-only=` - - alpha - - arc - - arm - - arm64 - - ia64 - - loongarch64 - - mips64-le - - mips-le - - parisc - - ppc - - ppc64 - - ppc64-le - - riscv32 - - riscv64 - - s390 - - s390x - - tilegx - - x86 - - x86-64 +: If specified, the package manager is instructed not to contact the + network for updating package data. This provides a minimal level of + reproducibility, as long as the package cache is already fully + populated. ### [Output] Section @@ -398,6 +406,16 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t in the default name, e.g. a specified image version of `7.8` might result in an image file name of `image_7.8.raw.xz`. +`CompressOutput=`, `--compress-output=` + +: Configure compression for the resulting image or archive. The + argument can be either a boolean or a compression algorithm (`xz`, + `zstd`). `xz` compression is used by default. Note that when applied + to block device image types this means the image cannot be started + directly but needs to be decompressed first. This also means that + the `shell`, `boot`, `qemu` verbs are not available when this option + is used. Implied for `tar` and `cpio`. + `OutputDirectory=`, `--output-dir=`, `-O` : Path to a directory where to place all generated artifacts. If this is @@ -439,26 +457,6 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t is automatically used for this purpose (also see the "Files" section below). -`UseSubvolumes=`, `--use-subvolumes=` - -: Takes a boolean or `auto`. Enables or disables use of btrfs subvolumes for - directory tree outputs. If enabled, mkosi will create the root directory as - a btrfs subvolume and use btrfs subvolume snapshots where possible to copy - base or cached trees which is much faster than doing a recursive copy. If - explicitly enabled and `btrfs` is not installed or subvolumes cannot be - created, an error is raised. If `auto`, missing `btrfs` or failures to - create subvolumes are ignored. - -`CompressOutput=`, `--compress-output=` - -: Configure compression for the resulting image or archive. The - argument can be either a boolean or a compression algorithm (`xz`, - `zstd`). `xz` compression is used by default. Note that when applied - to block device image types this means the image cannot be started - directly but needs to be decompressed first. This also means that - the `shell`, `boot`, `qemu` verbs are not available when this option - is used. Implied for `tar` and `cpio`. - `ImageVersion=`, `--image-version=` : Configure the image version. This accepts any string, but it is @@ -517,6 +515,16 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t https://uapi-group.org/specifications/specs/extension_image for more information. +`UseSubvolumes=`, `--use-subvolumes=` + +: Takes a boolean or `auto`. Enables or disables use of btrfs subvolumes for + directory tree outputs. If enabled, mkosi will create the root directory as + a btrfs subvolume and use btrfs subvolume snapshots where possible to copy + base or cached trees which is much faster than doing a recursive copy. If + explicitly enabled and `btrfs` is not installed or subvolumes cannot be + created, an error is raised. If `auto`, missing `btrfs` or failures to + create subvolumes are ignored. + ### [Content] Section `Packages=`, `--package=`, `-p` @@ -555,6 +563,16 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t in the "Development Tools" group, and the package that contains the `mypy` python module. +`BuildPackages=`, `--build-package=` + +: Similar to `Packages=`, but configures packages to install only in an + overlay that is made available on top of the image to the prepare + script when executed with the `build` argument and the build script. + This option should be used to list packages containing header files, + compilers, build systems, linkers and other build tools the + `mkosi.build` script requires to operate. Note that packages listed + here will be absent in the final image. + `WithDocs=`, `--with-docs` : Include documentation in the image built. By default if the @@ -563,30 +581,6 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t variable passed to the `mkosi.build` script indicates whether this option was used or not. -`WithTests=`, `--without-tests`, `-T` - -: If set to false (or when the command-line option is used), the - `$WITH_TESTS` environment variable is set to `0` when the - `mkosi.build` script is invoked. This is supposed to be used by the - build script to bypass any unit or integration tests that are - normally run during the source build process. Note that this option - has no effect unless the `mkosi.build` build script honors it. - -`Bootable=`, `--bootable=` - -: Takes a boolean or `auto`. Enables or disables generation of a bootable - image. If enabled, mkosi will install systemd-boot, and add an ESP partition - when the disk image output is used. If systemd-boot is not installed or no - kernel images can be found, the build will fail. `auto` behaves as if the - option was enabled, but the build won't fail if either no kernel images or - systemd-boot can't be found. If disabled, systemd-boot won't be installed even - if found inside the image, no unified kernel images will be generated and no - ESP partition will be added to the image if the disk output format is used. - -`KernelCommandLine=`, `--kernel-command-line=` - -: Use the specified kernel command line when building images. - `BaseTrees=`, `--base-tree=` : Takes a colon separated pair of directories to use as base images. When @@ -649,70 +643,36 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t file may be provided too. `mkosi.extra.tar` will be automatically used if found in the local directory. -`CleanPackageMetadata=`, `--clean-package-metadata=` +`RemovePackages=`, `--remove-package=` -: Enable/disable removal of package manager databases at the end of - installation. Can be specified as true, false, or "`auto`" (the - default). With "`auto`", files will be removed if the respective - package manager executable is *not* present at the end of the - installation. +: Takes a comma-separated list of package specifications for removal, in + the same format as `Packages=`. The removal will be performed as one + of the last steps. This step is skipped if `CleanPackageMetadata=no` + is used. `RemoveFiles=`, `--remove-files=` : Takes a comma-separated list of globs. Files in the image matching the globs will be purged at the end. -`RemovePackages=`, `--remove-package=` - -: Takes a comma-separated list of package specifications for removal, in the - same format as `Packages=`. The removal will be performed as one of the last - steps. This step is skipped if `CleanPackageMetadata=no` is used. - -: This option is currently only implemented for distributions using `dnf`. - -`Environment=`, `--environment=` - -: Adds variables to the environment that package managers and the - prepare/build/postinstall/finalize scripts are executed with. Takes - a space-separated list of variable assignments or just variable - names. In the latter case, the values of those variables will be - passed through from the environment in which `mkosi` was invoked. - This option may be specified more than once, in which case all - listed variables will be set. If the same variable is set twice, the - later setting overrides the earlier one. - -`BuildSources=`, `--build-sources=` - -: Takes a list of colon-separated pairs of paths to source trees and where to mount them in the development - image, if the build script is used. Every target path is prefixed with `/work/src` and all build sources - are sorted lexicographically by mount target before mounting so that top level paths are mounted first. By - default, the current working directory is mounted to `/work/src`. - -`BuildPackages=`, `--build-package=` +`CleanPackageMetadata=`, `--clean-package-metadata=` -: Similar to `Packages=`, but configures packages to install only in an - overlay that is made available on top of the image to the prepare - script when executed with the `build` argument and the build script. - This option should be used to list packages containing header files, - compilers, build systems, linkers and other build tools the - `mkosi.build` script requires to operate. Note that packages listed - here will be absent in the final image. +: Enable/disable removal of package manager databases at the end of + installation. Can be specified as true, false, or "`auto`" (the + default). With "`auto`", files will be removed if the respective + package manager executable is *not* present at the end of the + installation. -`Autologin=`, `--autologin` +`PrepareScript=`, `--prepare-script=` -: Enable autologin for the `root` user on `/dev/pts/0` (nspawn), - `/dev/tty1` and `/dev/ttyS0`. +: Takes a path to an executable that is used as the prepare script for + this image. See the `SCRIPTS` section for more information. `BuildScript=`, `--build-script=` : Takes a path to an executable that is used as build script for this image. See the `SCRIPTS` section for more information. -`PrepareScript=`, `--prepare-script=` - -: Takes a path to an executable that is used as the prepare script for - this image. See the `SCRIPTS` section for more information. - `PostInstallationScript=`, `--postinst-script=` : Takes a path to an executable that is used as the post-installation @@ -723,6 +683,35 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t : Takes a path to an executable that is used as the finalize script for this image. See the `SCRIPTS` section for more information. +`BuildSources=`, `--build-sources=` + +: Takes a list of colon-separated pairs of paths to source trees and + where to mount them in the development image, if the build script is + used. Every target path is prefixed with `/work/src` and all build + sources are sorted lexicographically by mount target before mounting + so that top level paths are mounted first. By default, the current + working directory is mounted to `/work/src`. + +`Environment=`, `--environment=` + +: Adds variables to the environment that package managers and the + prepare/build/postinstall/finalize scripts are executed with. Takes + a space-separated list of variable assignments or just variable + names. In the latter case, the values of those variables will be + passed through from the environment in which `mkosi` was invoked. + This option may be specified more than once, in which case all + listed variables will be set. If the same variable is set twice, the + later setting overrides the earlier one. + +`WithTests=`, `--without-tests`, `-T` + +: If set to false (or when the command-line option is used), the + `$WITH_TESTS` environment variable is set to `0` when the + `mkosi.build` script is invoked. This is supposed to be used by the + build script to bypass any unit or integration tests that are + normally run during the source build process. Note that this option + has no effect unless the `mkosi.build` build script honors it. + `WithNetwork=`, `--with-network=` : When true, enables network connectivity while the build script @@ -731,23 +720,27 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t passed to the `mkosi.build` build script indicating whether the build is done with or without network. -`CacheOnly=`, `--cache-only=` +`Bootable=`, `--bootable=` -: If specified, the package manager is instructed not to contact the - network for updating package data. This provides a minimal level of - reproducibility, as long as the package cache is already fully - populated. +: Takes a boolean or `auto`. Enables or disables generation of a + bootable image. If enabled, mkosi will install systemd-boot, and add + an ESP partition when the disk image output is used. If systemd-boot + is not installed or no kernel images can be found, the build will + fail. `auto` behaves as if the option was enabled, but the build won't + fail if either no kernel images or systemd-boot can't be found. If + disabled, systemd-boot won't be installed even if found inside the + image, no unified kernel images will be generated and no ESP partition + will be added to the image if the disk output format is used. -`Initrd=`, `--initrd` +`Initrds=`, `--initrd` -: Use user-provided initrd(s). Takes a comma separated list of paths to initrd - files. This option may be used multiple times in which case the initrd lists - are combined. +: Use user-provided initrd(s). Takes a comma separated list of paths to + initrd files. This option may be used multiple times in which case the + initrd lists are combined. -`MakeInitrd=`, `--make-initrd` +`KernelCommandLine=`, `--kernel-command-line=` -: Add `/etc/initrd-release` and `/init` to the image so that it can be - used as an initramfs. +: Use the specified kernel command line when building images. `KernelModulesInclude=`, `--kernel-modules-include=` @@ -799,6 +792,29 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t as an already hashed root password. The root password is also stored in `/usr/lib/credstore` under the appropriate systemd credential so that it applies even if only `/usr` is shipped in the image. +`Autologin=`, `--autologin` + +: Enable autologin for the `root` user on `/dev/pts/0` (nspawn), + `/dev/tty1` and `/dev/ttyS0`. + +`MakeInitrd=`, `--make-initrd` + +: Add `/etc/initrd-release` and `/init` to the image so that it can be + used as an initramfs. + +`Ssh=`, `--ssh` + +: If specified, an sshd socket unit and matching service are installed + in the final image that expose SSH over VSock. When building with this + option and running the image using `mkosi qemu`, the `mkosi ssh` + command can be used to connect to the container/VM via SSH. Note that + you still have to make sure openssh is installed in the image to make + this option behave correctly. mkosi will automatically provision the + user's public SSH key into the image using the + `ssh.authorized_keys.root` credential if it can be retrieved from a + running SSH agent. To access images booted using `mkosi boot`, use + `machinectl`. + ### [Validation] Section `SecureBoot=`, `--secure-boot` @@ -841,6 +857,14 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t which is the default, which is equal to a true value if the `systemd-measure` binary is in `PATH`. +`Passphrase=`, `--passphrase` + +: Specify the path to a file containing the passphrase to use for LUKS + encryption. It should contain the passphrase literally, and not end in + a newline character (i.e. in the same format as cryptsetup and + `/etc/crypttab` expect the passphrase files). The file must have an + access mode of 0600 or less. + `Checksum=`, `--checksum` : Generate a `SHA256SUMS` file of all generated artifacts after the @@ -927,19 +951,6 @@ they should be specified with a boolean argument: either "1", "yes", or "true" t temporary snapshot is more efficient on file systems that support reflinks natively ("btrfs" or new "xfs") than on more traditional file systems that do not ("ext4"). -`Ssh=`, `--ssh` - -: If specified, an sshd socket unit and matching service are installed - in the final image that expose SSH over VSock. When building with this - option and running the image using `mkosi qemu`, the `mkosi ssh` - command can be used to connect to the container/VM via SSH. Note that - you still have to make sure openssh is installed in the image to make - this option behave correctly. mkosi will automatically provision the - user's public SSH key into the image using the - `ssh.authorized_keys.root` credential if it can be retrieved from a - running SSH agent. To access images booted using `mkosi boot`, use - `machinectl`. - `Credentials=`, `--credential=` : Set credentials to be passed to systemd-nspawn or qemu respectively when diff --git a/mkosi/config.py b/mkosi/config.py index b1c969ca2..4b9072ac7 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -18,7 +18,7 @@ import string import subprocess import sys import textwrap -from collections.abc import Sequence +from collections.abc import Iterable, Sequence from itertools import takewhile from pathlib import Path from typing import Any, Callable, Optional, Type, Union, cast @@ -845,6 +845,13 @@ class MkosiConfigParser: parse=config_make_list_parser(delimiter=","), help="Repositories to use", ), + MkosiConfigSetting( + dest="cache_only", + metavar="BOOL", + section="Distribution", + parse=config_parse_boolean, + help="Only use the package cache when installing packages", + ), MkosiConfigSetting( dest="output_format", @@ -874,6 +881,14 @@ class MkosiConfigParser: parse=config_parse_filename, help="Output name", ), + MkosiConfigSetting( + dest="compress_output", + metavar="ALG", + nargs="?", + section="Output", + parse=config_parse_compression, + help="Enable whole-output compression (with images or archives)", + ), MkosiConfigSetting( dest="output_dir", short="-O", @@ -912,14 +927,6 @@ class MkosiConfigParser: paths=("mkosi.builddir",), help="Path to use as persistent build directory", ), - MkosiConfigSetting( - dest="compress_output", - metavar="ALG", - nargs="?", - section="Output", - parse=config_parse_compression, - help="Enable whole-output compression (with images or archives)", - ), MkosiConfigSetting( dest="image_version", match=config_match_image_version, @@ -977,12 +984,12 @@ class MkosiConfigParser: help="Add an additional package to the OS image", ), MkosiConfigSetting( - dest="remove_packages", - long="--remove-package", + dest="build_packages", + long="--build-package", metavar="PACKAGE", section="Content", parse=config_make_list_parser(delimiter=","), - help="Remove package from the image OS image after installation", + help="Additional packages needed for build script", ), MkosiConfigSetting( dest="with_docs", @@ -992,42 +999,6 @@ class MkosiConfigParser: parse=config_parse_boolean, help="Install documentation", ), - MkosiConfigSetting( - dest="with_tests", - short="-T", - long="--without-tests", - nargs="?", - const="no", - section="Content", - parse=config_parse_boolean, - default=True, - help="Do not run tests as part of build script, if supported", - ), - MkosiConfigSetting( - dest="kernel_command_line", - metavar="OPTIONS", - section="Content", - parse=config_make_list_parser(delimiter=" "), - default=["console=ttyS0"], - help="Set the kernel command line (only bootable images)", - ), - MkosiConfigSetting( - dest="bootable", - metavar="FEATURE", - nargs="?", - section="Content", - parse=config_parse_feature, - match=config_match_feature, - help="Generate ESP partition with systemd-boot and UKIs for installed kernels", - ), - MkosiConfigSetting( - dest="autologin", - metavar="BOOL", - nargs="?", - section="Content", - parse=config_parse_boolean, - help="Enable root autologin", - ), MkosiConfigSetting( dest="base_trees", long='--base-tree', @@ -1036,15 +1007,6 @@ class MkosiConfigParser: parse=config_make_list_parser(delimiter=",", parse=make_path_parser(required=False)), help='Use the given tree as base tree (e.g. lower sysext layer)', ), - MkosiConfigSetting( - dest="extra_trees", - long="--extra-tree", - metavar="PATH", - section="Content", - parse=config_make_list_parser(delimiter=",", parse=make_source_target_paths_parser()), - paths=("mkosi.extra", "mkosi.extra.tar"), - help="Copy an extra tree on top of image", - ), MkosiConfigSetting( dest="skeleton_trees", long="--skeleton-tree", @@ -1064,11 +1026,21 @@ class MkosiConfigParser: help="Use a package manager tree to configure the package manager", ), MkosiConfigSetting( - dest="clean_package_metadata", - metavar="FEATURE", + dest="extra_trees", + long="--extra-tree", + metavar="PATH", section="Content", - parse=config_parse_feature, - help="Remove package manager database and other files", + parse=config_make_list_parser(delimiter=",", parse=make_source_target_paths_parser()), + paths=("mkosi.extra", "mkosi.extra.tar"), + help="Copy an extra tree on top of image", + ), + MkosiConfigSetting( + dest="remove_packages", + long="--remove-package", + metavar="PACKAGE", + section="Content", + parse=config_make_list_parser(delimiter=","), + help="Remove package from the image OS image after installation", ), MkosiConfigSetting( dest="remove_files", @@ -1078,27 +1050,19 @@ class MkosiConfigParser: help="Remove files from built image", ), MkosiConfigSetting( - dest="environment", - short="-E", - metavar="NAME[=VALUE]", + dest="clean_package_metadata", + metavar="FEATURE", section="Content", - parse=config_make_list_parser(delimiter=" ", unescape=True), - help="Set an environment variable when running scripts", + parse=config_parse_feature, + help="Remove package manager database and other files", ), MkosiConfigSetting( - dest="build_sources", + dest="prepare_script", metavar="PATH", section="Content", - parse=config_make_list_parser(delimiter=",", parse=make_source_target_paths_parser(absolute=False)), - help="Path for sources to build", - ), - MkosiConfigSetting( - dest="build_packages", - long="--build-package", - metavar="PACKAGE", - section="Content", - parse=config_make_list_parser(delimiter=","), - help="Additional packages needed for build script", + parse=config_parse_script, + paths=("mkosi.prepare",), + help="Prepare script to run inside the image before it is cached", ), MkosiConfigSetting( dest="build_script", @@ -1108,14 +1072,6 @@ class MkosiConfigParser: paths=("mkosi.build",), help="Build script to run inside image", ), - MkosiConfigSetting( - dest="prepare_script", - metavar="PATH", - section="Content", - parse=config_parse_script, - paths=("mkosi.prepare",), - help="Prepare script to run inside the image before it is cached", - ), MkosiConfigSetting( dest="postinst_script", metavar="PATH", @@ -1133,6 +1089,32 @@ class MkosiConfigParser: paths=("mkosi.finalize",), help="Postinstall script to run outside image", ), + MkosiConfigSetting( + dest="build_sources", + metavar="PATH", + section="Content", + parse=config_make_list_parser(delimiter=",", parse=make_source_target_paths_parser(absolute=False)), + help="Path for sources to build", + ), + MkosiConfigSetting( + dest="environment", + short="-E", + metavar="NAME[=VALUE]", + section="Content", + parse=config_make_list_parser(delimiter=" ", unescape=True), + help="Set an environment variable when running scripts", + ), + MkosiConfigSetting( + dest="with_tests", + short="-T", + long="--without-tests", + nargs="?", + const="no", + section="Content", + parse=config_parse_boolean, + default=True, + help="Do not run tests as part of build script, if supported", + ), MkosiConfigSetting( dest="with_network", metavar="BOOL", @@ -1142,11 +1124,13 @@ class MkosiConfigParser: help="Run build and postinst scripts with network access (instead of private network)", ), MkosiConfigSetting( - dest="cache_only", - metavar="BOOL", + dest="bootable", + metavar="FEATURE", + nargs="?", section="Content", - parse=config_parse_boolean, - help="Only use the package cache when installing packages", + parse=config_parse_feature, + match=config_match_feature, + help="Generate ESP partition with systemd-boot and UKIs for installed kernels", ), MkosiConfigSetting( dest="initrds", @@ -1157,12 +1141,12 @@ class MkosiConfigParser: help="Add a user-provided initrd to image", ), MkosiConfigSetting( - dest="make_initrd", - metavar="BOOL", - nargs="?", + dest="kernel_command_line", + metavar="OPTIONS", section="Content", - parse=config_parse_boolean, - help="Make sure the image can be used as an initramfs", + parse=config_make_list_parser(delimiter=" "), + default=["console=ttyS0"], + help="Set the kernel command line (only bootable images)", ), MkosiConfigSetting( dest="kernel_modules_include", @@ -1252,6 +1236,30 @@ class MkosiConfigParser: parse=config_parse_string, help="Set the shell for root", ), + MkosiConfigSetting( + dest="autologin", + metavar="BOOL", + nargs="?", + section="Content", + parse=config_parse_boolean, + help="Enable root autologin", + ), + MkosiConfigSetting( + dest="make_initrd", + metavar="BOOL", + nargs="?", + section="Content", + parse=config_parse_boolean, + help="Make sure the image can be used as an initramfs", + ), + MkosiConfigSetting( + dest="ssh", + metavar="BOOL", + nargs="?", + section="Content", + parse=config_parse_boolean, + help="Set up SSH access from the host to the final image via 'mkosi ssh'", + ), MkosiConfigSetting( dest="secure_boot", @@ -1430,14 +1438,6 @@ class MkosiConfigParser: 'image that is removed immediately when the container/VM terminates'), nargs="?", ), - MkosiConfigSetting( - dest="ssh", - metavar="BOOL", - nargs="?", - section="Host", - parse=config_parse_boolean, - help="Set up SSH access from the host to the final image via 'mkosi ssh'", - ), MkosiConfigSetting( dest="credentials", long="--credential", @@ -2197,7 +2197,7 @@ def none_to_default(s: Optional[object]) -> str: return "default" if s is None else str(s) -def line_join_list(array: Sequence[PathString]) -> str: +def line_join_list(array: Iterable[PathString]) -> str: if not array: return "none" @@ -2229,55 +2229,68 @@ def summary(args: MkosiArgs, config: MkosiConfig) -> str: {bold(f"PRESET: {config.preset or 'default'}")} {bold("COMMANDS")}: - verb: {bold(args.verb)} - cmdline: {bold(" ".join(args.cmdline))} + Verb: {bold(args.verb)} + Cmdline: {bold(" ".join(args.cmdline))} {bold("DISTRIBUTION")}: - Distribution: {bold(config.distribution.name)} + Distribution: {bold(config.distribution)} Release: {bold(none_to_na(config.release))} Architecture: {config.architecture} Mirror: {none_to_default(config.mirror)} Local Mirror (build): {none_to_none(config.local_mirror)} Repo Signature/Key check: {yes_no(config.repository_key_check)} - Repositories: {",".join(config.repositories)} + Repositories: {line_join_list(config.repositories)} + Use Only Package Cache: {yes_no(config.cache_only)} {bold("OUTPUT")}: - Image ID: {config.image_id} - Image Version: {config.image_version} - Output Format: {config.output_format.name} + Output Format: {config.output_format} Manifest Formats: {maniformats} + Output: {bold(config.output_with_compression)} + Compression: {config.compress_output} Output Directory: {none_to_default(config.output_dir)} Workspace Directory: {none_to_default(config.workspace_dir)} Cache Directory: {none_to_none(config.cache_dir)} Build Directory: {none_to_none(config.build_dir)} + Image ID: {config.image_id} + Image Version: {config.image_version} + Split Artifacts: {yes_no(config.split_artifacts)} Repart Directories: {line_join_list(config.repart_dirs)} - Output: {bold(config.output_with_compression)} - Output Checksum: {none_to_na(config.output_checksum if config.checksum else None)} - Output Signature: {none_to_na(config.output_signature if config.sign else None)} - Output nspawn Settings: {none_to_na(config.output_nspawn_settings if config.nspawn_settings is not None else None)} - Compression: {config.compress_output.name} + Overlay: {yes_no(config.overlay)} + Use Subvolumes: {yes_no_auto(config.use_subvolumes)} {bold("CONTENT")}: Packages: {line_join_list(config.packages)} + Build Packages: {line_join_list(config.build_packages)} With Documentation: {yes_no(config.with_docs)} + + Base Trees: {line_join_list(config.base_trees)} Skeleton Trees: {line_join_source_target_list(config.skeleton_trees)} Package Manager Trees: {line_join_source_target_list(config.package_manager_trees)} Extra Trees: {line_join_source_target_list(config.extra_trees)} - Clean Package Metadata: {yes_no_auto(config.clean_package_metadata)} - Remove Files: {line_join_list(config.remove_files)} + Remove Packages: {line_join_list(config.remove_packages)} - Build Sources: {line_join_source_target_list(config.build_sources)} - Build Packages: {line_join_list(config.build_packages)} + Remove Files: {line_join_list(config.remove_files)} +Clean Package Manager Metadata: {yes_no_auto(config.clean_package_metadata)} + + Prepare Script: {none_to_none(config.prepare_script)} Build Script: {none_to_none(config.build_script)} - Run Tests in Build Script: {yes_no(config.with_tests)} Postinstall Script: {none_to_none(config.postinst_script)} - Prepare Script: {none_to_none(config.prepare_script)} Finalize Script: {none_to_none(config.finalize_script)} + Build Sources: {line_join_source_target_list(config.build_sources)} Script Environment: {line_join_list(env)} - Scripts with network: {yes_no(config.with_network)} + Run Tests in Build Script: {yes_no(config.with_tests)} + Scripts With Network: {yes_no(config.with_network)} + Bootable: {yes_no_auto(config.bootable)} - Kernel Command Line: {" ".join(config.kernel_command_line)} - Initrds: {",".join(os.fspath(p) for p in config.initrds)} + Initrds: {line_join_list(config.initrds)} + Kernel Command Line: {line_join_list(config.kernel_command_line)} + Kernel Modules Include: {line_join_list(config.kernel_modules_include)} + Kernel Modules Exclude: {line_join_list(config.kernel_modules_exclude)} + + Kernel Modules Initrd: {yes_no(config.kernel_modules_initrd)} + Kernel Modules Initrd Include: {line_join_list(config.kernel_modules_initrd_include)} + Kernel Modules Initrd Exclude: {line_join_list(config.kernel_modules_initrd_include)} + Locale: {none_to_default(config.locale)} Locale Messages: {none_to_default(config.locale_messages)} Keymap: {none_to_default(config.keymap)} @@ -2285,14 +2298,10 @@ def summary(args: MkosiArgs, config: MkosiConfig) -> str: Hostname: {none_to_default(config.hostname)} Root Password: {("(set)" if config.root_password else "(default)")} Root Shell: {none_to_default(config.root_shell)} - Autologin: {yes_no(config.autologin)} - {bold("HOST CONFIGURATION")}: - Incremental: {yes_no(config.incremental)} - NSpawn Settings: {none_to_none(config.nspawn_settings)} - Extra search paths: {line_join_list(config.extra_search_paths)} - QEMU Extra Arguments: {line_join_list(config.qemu_args)} - Extra Kernel Command Line: {line_join_list(config.kernel_command_line_extra)} + Autologin: {yes_no(config.autologin)} + Make Initrd: {yes_no(config.make_initrd)} + SSH: {yes_no(config.ssh)} """ if config.output_format == OutputFormat.disk: @@ -2305,9 +2314,31 @@ def summary(args: MkosiArgs, config: MkosiConfig) -> str: SecureBoot Sign Tool: {config.secure_boot_sign_tool} Verity Signing Key: {none_to_none(config.verity_key)} Verity Certificate: {none_to_none(config.verity_certificate)} + Sign Expected PCRs: {yes_no_auto(config.sign_expected_pcr)} + Passphrase: {none_to_none(config.passphrase)} Checksum: {yes_no(config.checksum)} Sign: {yes_no(config.sign)} GPG Key: ({"default" if config.key is None else config.key}) """ + summary += f"""\ + + {bold("HOST CONFIGURATION")}: + Incremental: {yes_no(config.incremental)} + NSpawn Settings: {none_to_none(config.nspawn_settings)} + Extra search paths: {line_join_list(config.extra_search_paths)} + QEMU GUI: {yes_no(config.qemu_gui)} + QEMU CPU Cores: {config.qemu_smp} + QEMU Memory: {config.qemu_mem} + QEMU Use KVM: {config.qemu_kvm} + QEMU Use VSock: {config.qemu_vsock} + QEMU Use Swtpm: {config.qemu_swtpm} + QEMU Extra Arguments: {line_join_list(config.qemu_args)} + Ephemeral: {config.ephemeral} + Credentials: {line_join_list(config.credentials.keys())} + Extra Kernel Command Line: {line_join_list(config.kernel_command_line_extra)} + Use ACLs: {config.acl} + Tools Tree: {config.tools_tree} +""" + return summary