From e94aef7dcea5bd79ade677244acb7f8aadeded8d Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 22 Apr 2024 15:08:09 +0200 Subject: [PATCH] stages: new bootc.install.config stage New stage for writing a bootc-install-config with all the options currently supported. See bootc-install-config(5). --- stages/org.osbuild.bootc.install.config | 29 +++++++ ...org.osbuild.bootc.install.config.meta.json | 78 +++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100755 stages/org.osbuild.bootc.install.config create mode 100644 stages/org.osbuild.bootc.install.config.meta.json diff --git a/stages/org.osbuild.bootc.install.config b/stages/org.osbuild.bootc.install.config new file mode 100755 index 00000000..10a2664c --- /dev/null +++ b/stages/org.osbuild.bootc.install.config @@ -0,0 +1,29 @@ +#!/usr/bin/python3 +import pathlib +import sys + +try: + import toml +except ModuleNotFoundError: + import pytoml as toml + +import osbuild.api + + +def main(tree, options): + filename = options["filename"] + config = options["config"] + + path = pathlib.Path(tree) / "usr/lib/bootc/install" / filename + path.parent.mkdir(parents=True, exist_ok=True) + + with open(path, "w", encoding="utf8") as config_file: + toml.dump(config, config_file) + + return 0 + + +if __name__ == '__main__': + args = osbuild.api.arguments() + r = main(args["tree"], args["options"]) + sys.exit(r) diff --git a/stages/org.osbuild.bootc.install.config.meta.json b/stages/org.osbuild.bootc.install.config.meta.json new file mode 100644 index 00000000..a5f7e379 --- /dev/null +++ b/stages/org.osbuild.bootc.install.config.meta.json @@ -0,0 +1,78 @@ +{ + "summary": "Write bootc-install-config(5) file", + "description": [ + "The bootc install process supports some basic customization. This", + "configuration file is in TOML format, and will be discovered by the", + "installation process in via drop-in files in /usr/lib/bootc/install that", + "are processed in alphanumerical order.", + "The individual files are merged into a single final installation config, so", + "it is supported for e.g. a container base image to provide a default root", + "filesystem type, that can be overridden in a derived container image." + ], + "schema": { + "additionalProperties": false, + "required": [ + "filename", + "config" + ], + "properties": { + "filename": { + "type": "string", + "description": "name of the configuration file." + }, + "config": { + "additionalProperties": false, + "type": "object", + "minProperties": 1, + "properties": { + "install": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "filesystem": { + "type": "object", + "required": [ + "root" + ], + "additionalProperties": false, + "properties": { + "root": { + "type": "object", + "required": [ + "type" + ], + "additionalProperties": false, + "properties": { + "type": { + "type": "string" + } + } + } + } + }, + "kargs": { + "type": "array", + "description": "Append extra kernel arguments", + "items": { + "type": "string" + } + }, + "block": { + "type": "array", + "description": "An array of supported to-disk backends enabled by this base container image; if not specified, this will just be direct.", + "items": { + "type": "string", + "enum": [ + "direct", + "tmp2-luks" + ] + } + } + } + } + } + } + } + } +}