import subprocess
import sys
import textwrap
+import uuid
from collections.abc import Iterable, Sequence
from pathlib import Path
from typing import Any, Callable, Optional, Type, Union, cast
except KeyError:
return Compression.zst if parse_boolean(value) else Compression.none
+def config_parse_seed(value: Optional[str], old: Optional[str]) -> Optional[uuid.UUID]:
+ if not value or value == "random":
+ return None
+
+ try:
+ return uuid.UUID(value)
+ except ValueError:
+ die(f"{value} is not a valid UUID")
+
+
def config_default_release(namespace: argparse.Namespace) -> str:
# If we encounter Release in [Match] and no distribution has been set yet, configure the default
sector_size: Optional[str]
overlay: bool
use_subvolumes: ConfigFeature
+ seed: Optional[uuid.UUID]
packages: list[str]
build_packages: list[str]
parse=config_parse_feature,
help="Use btrfs subvolumes for faster directory operations where possible",
),
+ MkosiConfigSetting(
+ dest="seed",
+ metavar="UUID",
+ section="Output",
+ parse=config_parse_seed,
+ help="Set the seed for systemd-repart",
+ ),
MkosiConfigSetting(
dest="packages",
return "n/a" if s is None else str(s)
+def none_to_random(s: Optional[object]) -> str:
+ return "random" if s is None else str(s)
+
+
def none_to_none(s: Optional[object]) -> str:
return "none" if s is None else str(s)
Sector Size: {none_to_default(config.sector_size)}
Overlay: {yes_no(config.overlay)}
Use Subvolumes: {yes_no_auto(config.use_subvolumes)}
+ Seed: {none_to_random(config.seed)}
{bold("CONTENT")}:
Packages: {line_join_list(config.packages)}
created, an error is raised. If `auto`, missing `btrfs` or failures to
create subvolumes are ignored.
+`Seed=`, `--seed=`
+
+: Takes a UUID as argument or the special value `random`.
+ Overrides the seed that [`systemd-repart(8)`](https://www.freedesktop.org/software/systemd/man/systemd-repart.service.html)
+ uses when building a disk image. This is useful to achieve reproducible
+ builds, where deterministic UUIDs and other partition metadata should be
+ derived on each build.
+
### [Content] Section
`Packages=`, `--package=`, `-p`