diff --git a/stages/org.osbuild.kickstart b/stages/org.osbuild.kickstart index e7a6adfe6c..10878b5800 100755 --- a/stages/org.osbuild.kickstart +++ b/stages/org.osbuild.kickstart @@ -16,7 +16,7 @@ from typing import Dict, List import osbuild.api -SCHEMA = """ +SCHEMA = r""" "additionalProperties": false, "required": ["path"], "properties": { @@ -131,6 +131,44 @@ SCHEMA = """ "timezone": { "type": "string", "description": "The timezone (e.g. UTC)" + }, + "zerombr": { + "type": "boolean", + "description": "Reinitialize Partition Tables" + }, + "clearpart": { + "description": "Removes partitions from the system, prior to creation of new partitions", + "type": "object", + "properties": { + "all": { + "description": "Erases all partitions from the system", + "type": "boolean" + }, + "drives": { + "description": "Specifies which drives to clear partitions from", + "type": "array", + "items": { + "type": "string", + "pattern": "^[A-Za-z0-9/:\\_|*-]+$" + } + }, + "list": { + "description": "Specifies which partitions to clear", + "type": "array", + "items": { + "type": "string", + "pattern": "^[A-Za-z0-9]+$" + } + }, + "disklabel": { + "description": "Create a set disk label when relabeling a disk", + "type": "string" + }, + "linux": { + "description": "Erases all Linux partitions", + "type": "boolean" + } + } } } """ @@ -233,6 +271,29 @@ def main(tree, options): tz = options.get("timezone") if tz: config += [f"timezone {tz}"] + zerombr = options.get("zerombr") + if zerombr: + config += ["zerombr"] + + clearpart = options.get("clearpart") + if clearpart: + cmd = "clearpart" + all = clearpart["all"] + if all: + cmd += " --all" + drives = clearpart["drives"] + if drives: + cmd += f" --drives={','.join(drives)}" + list = clearpart["list"] + if list: + cmd += f" --list={','.join(list)}" + disklabel = clearpart["disklabel"] + if disklabel: + cmd += f" --disklabel={disklabel}" + linux = clearpart["linux"] + if linux: + cmd += f" --linux={linux}" + config += [cmd] target = os.path.join(tree, path) base = os.path.dirname(target)