From: Daan De Meyer Date: Sat, 8 Feb 2025 09:59:05 +0000 (+0100) Subject: Add support for SplitArtifacts=tar X-Git-Tag: v26~405 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f94a3869806c5c10d4df9313ec1aeff871844bb;p=thirdparty%2Fmkosi.git Add support for SplitArtifacts=tar --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index d0d77b88c..de8cca331 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -3855,6 +3855,12 @@ def build_image(context: Context) -> None: if ArtifactOutput.partitions in context.config.split_artifacts: make_disk(context, split=True, msg="Extracting partitions") + if ( + context.config.output_format != OutputFormat.tar + and ArtifactOutput.tar in context.config.split_artifacts + ): + make_tar(context.root, context.staging / context.config.output_tar, sandbox=context.sandbox) + copy_nspawn_settings(context) copy_uki(context) copy_vmlinuz(context) diff --git a/mkosi/config.py b/mkosi/config.py index 7d46d0339..d305a177a 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -570,6 +570,7 @@ class ArtifactOutput(StrEnum): kernel = enum.auto() initrd = enum.auto() partitions = enum.auto() + tar = enum.auto() @staticmethod def compat_no() -> list["ArtifactOutput"]: @@ -2061,6 +2062,15 @@ class Config: def output_changelog(self) -> str: return f"{self.output}.changelog" + @property + def output_tar(self) -> str: + output = f"{self.output}.tar" + + if self.compress_output: + output += self.compress_output.extension() + + return output + @property def outputs(self) -> list[str]: return [ @@ -2075,6 +2085,7 @@ class Config: self.output_signature, self.output_manifest, self.output_changelog, + self.output_tar, ] def cache_manifest(self) -> dict[str, Any]: diff --git a/mkosi/resources/man/mkosi.1.md b/mkosi/resources/man/mkosi.1.md index d6a4e8fe3..db3f4d576 100644 --- a/mkosi/resources/man/mkosi.1.md +++ b/mkosi/resources/man/mkosi.1.md @@ -603,10 +603,10 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, `SplitArtifacts=`, `--split-artifacts` : The artifact types to split out of the final image. A comma-delimited - list consisting of `uki`, `kernel`, `initrd` and `partitions`. When - building a bootable image `kernel` and `initrd` correspond to their - artifact found in the image (or in the UKI), while `uki` copies out the - entire UKI. + list consisting of `uki`, `kernel`, `initrd`, `partitions` and + `tar`. When building a bootable image `kernel` and `initrd` + correspond to their artifact found in the image (or in the UKI), + while `uki` copies out the entire UKI. When building a disk image and `partitions` is specified, pass `--split=yes` to **systemd-repart** to have it write out split partition @@ -615,7 +615,12 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, page for more information. This is useful in A/B update scenarios where an existing disk image shall be augmented with a new version of a root or `/usr` partition along with its Verity partition and unified - kernel. By default `uki`, `kernel` and `initrd` are split out. + kernel. + + When `tar` is specified, the rootfs is additionally archived as a + tar archive (compressed according to `CompressOutput=`). + + By default `uki`, `kernel` and `initrd` are split out. `RepartDirectories=`, `--repart-directory=` : Paths to directories containing **systemd-repart** partition definition