From c3b52ba2407b2ebbfccf94d85b47b2804fdb7ea4 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Tue, 12 Dec 2023 13:45:23 -0500 Subject: [PATCH] osbuild-mpp: add partnum field to the partitions Partitions are usually indexed starting a 1 so an index starting at 0 is confusing (i.e. you never say mount the filesystem on partition 0). Let's add a partnum field that can be used in definitions instead. --- tools/osbuild-mpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/osbuild-mpp b/tools/osbuild-mpp index ec66c6df..fbc0c8ff 100755 --- a/tools/osbuild-mpp +++ b/tools/osbuild-mpp @@ -831,6 +831,7 @@ class Partition: self.uuid = uuid self.attrs = attrs self.index = None + self.partnum = None @property def start_in_bytes(self): @@ -936,6 +937,7 @@ class PartitionTable: assert len(disk_parts) == len(self.partitions) for i, part in enumerate(self.partitions): part.index = i + part.partnum = i + 1 part.start = disk_parts[i]["start"] part.size = disk_parts[i]["size"] part.type = disk_parts[i].get("type")