diff --git a/stages/org.osbuild.kickstart b/stages/org.osbuild.kickstart index e7a6adfe6c..de5c5afd6f 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,45 @@ 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", + "pattern": "^[A-Za-z0-9_-]+$" + }, + "linux": { + "description": "Erases all Linux partitions", + "type": "boolean" + } + } } } """ @@ -233,6 +272,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 is not None: + cmd = "clearpart" + all = clearpart.get("all", False) + if all: + cmd += " --all" + drives = clearpart.get("drives", []) + if drives: + cmd += f" --drives={','.join(drives)}" + list = clearpart.get("list", []) + if list: + cmd += f" --list={','.join(list)}" + disklabel = clearpart.get("disklabel", "") + if disklabel: + cmd += f" --disklabel={disklabel}" + linux = clearpart.get("linux", False) + if linux: + cmd += f" --linux" + config += [cmd] target = os.path.join(tree, path) base = os.path.dirname(target)