From 19b330eadee7aa1864ed1989a2ed83b88d32bf0c Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Tue, 2 Jun 2020 14:11:54 +0200 Subject: [PATCH] stages: add org.osbuild.anaconda Add a stage to configure anaconda. For now only the enabled kickstart modules can be configured. This is done by dropping a file "90-osbuild.conf" in `/etc/anaconda/conf.d`. --- stages/org.osbuild.anaconda | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 stages/org.osbuild.anaconda diff --git a/stages/org.osbuild.anaconda b/stages/org.osbuild.anaconda new file mode 100755 index 00000000..7ccebfe5 --- /dev/null +++ b/stages/org.osbuild.anaconda @@ -0,0 +1,58 @@ +#!/usr/bin/python3 +""" +Configure basic aspects of the anaconda installer + +Create an anaconda configuration file `90-osbuild.conf` in +the folder `/etc/anaconda/conf.d` to configure anaconda. + +Currently only the list of enabled kickstart modules is +configurable via the `kickstart-modules` option. +""" + +import os +import sys + + +import osbuild.api + + +SCHEMA = """ +"additionalProperties": true, +"required": ["kickstart-modules"], +"properties": { + "kickstart-modules": { + "type": "array", + "description": "Kick start modules to enable", + "items": { + "type": "string" + }, + "minItems": 1 + } +} +""" + +CONFIG = """ +# osbuild customizations + +[Anaconda] +# List of enabled Anaconda DBus modules +kickstart_modules = +""" + + +def main(tree, options): + modules = options["kickstart-modules"] + product_dir = os.path.join(tree, "etc/anaconda/conf.d") + os.makedirs(product_dir, exist_ok=True) + + with open(os.path.join(product_dir, "90-osbuild.conf"), "w") as f: + f.write(CONFIG) + for m in modules: + f.write(f" {m}\n") + + +if __name__ == '__main__': + stage_args = osbuild.api.arguments() + r = main(stage_args["tree"], + stage_args["options"]) + sys.exit(r)