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).
This commit is contained in:
Achilleas Koutsou 2024-04-22 15:08:09 +02:00
parent c3da95780a
commit e94aef7dce
2 changed files with 107 additions and 0 deletions

View file

@ -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)

View file

@ -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"
]
}
}
}
}
}
}
}
}
}