]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add support for SplitArtifacts=tar
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 8 Feb 2025 09:59:05 +0000 (10:59 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 8 Feb 2025 18:54:56 +0000 (19:54 +0100)
mkosi/__init__.py
mkosi/config.py
mkosi/resources/man/mkosi.1.md

index d0d77b88c6db2f2e1f311131127d7995c60eab2e..de8cca331bfc3a88bc4657d3b53bc8adc9cf60fa 100644 (file)
@@ -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)
index 7d46d0339ee3928ddc1351323de74b45f9462355..d305a177a47ed63e5a412d90d819d5cd69057d93 100644 (file)
@@ -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]:
index d6a4e8fe31cc30900e5c171d4bbddefa507e1f7b..db3f4d576a2db756086bbdff56377e45eb74236c 100644 (file)
@@ -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