stages/sfdisk: remove unneeded helper functions

This was left over from the old qemu assembler and is not really
needed anymore. Also removes some defaults that are not valid
according to the new schema of the stage.
This commit is contained in:
Christian Kellner 2021-06-13 12:37:54 +00:00 committed by Tom Gundersen
parent 21fe0375cd
commit 386ff713cc

View file

@ -173,22 +173,17 @@ def partition_from_json(js) -> Partition:
return p
def partition_table_from_options(options) -> PartitionTable:
ptuuid = options["uuid"]
pttype = options.get("label", "dos")
partitions = options.get("partitions")
if pttype == "mbr":
pttype = "dos"
parts = [partition_from_json(p) for p in partitions]
return PartitionTable(pttype, ptuuid, parts)
def main(tree, options):
filename = options["filename"]
ptuuid = options["uuid"]
pttype = options["label"]
partitions = options.get("partitions")
dest = os.path.join(tree, filename.lstrip("/"))
pt = partition_table_from_options(options)
parts = [partition_from_json(p) for p in partitions]
pt = PartitionTable(pttype, ptuuid, parts)
pt.write_to(dest)
subprocess.run(["sfdisk", "--json", dest],