Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/partition.py
diff options
context:
space:
mode:
authorVictor Gavro <vgavro@gmail.com>2022-02-05 00:58:44 +0200
committerGitHub <noreply@github.com>2022-02-04 23:58:44 +0100
commit68c2988358426e8d0074479cef539ddadc2a31e6 (patch)
tree17ee0aa35065767a97c0b7686ff07378e722fce8 /archinstall/lib/disk/partition.py
parent85f2938df9e7e34a08fd1b1acc7c8b41d14ccb54 (diff)
disk layout: allow to omit partition "start" option to start from previous partition end (#895)
* disk layout: allow to omit partition "start" option to start from previous partition end * mixed tabs/spaces fixes * Update filesystem.py Co-authored-by: Anton Hvornum <anton.feeds+github@gmail.com>
Diffstat (limited to 'archinstall/lib/disk/partition.py')
-rw-r--r--archinstall/lib/disk/partition.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/archinstall/lib/disk/partition.py b/archinstall/lib/disk/partition.py
index afd34f20..7bfde64c 100644
--- a/archinstall/lib/disk/partition.py
+++ b/archinstall/lib/disk/partition.py
@@ -114,6 +114,7 @@ class Partition:
@property
def end(self) -> Optional[str]:
+ # TODO: actually this is size in sectors unit
# TODO: Verify that the logic holds up, that 'size' is the size without 'start' added to it.
output = json.loads(SysCommand(f"sfdisk --json {self.block_device.path}").decode('UTF-8'))
@@ -122,6 +123,14 @@ class Partition:
return partition['size'] # * self.sector_size
@property
+ def end_sectors(self) -> Optional[str]:
+ output = json.loads(SysCommand(f"sfdisk --json {self.block_device.path}").decode('UTF-8'))
+
+ for partition in output.get('partitiontable', {}).get('partitions', []):
+ if partition['node'] == self.path:
+ return partition['start'] + partition['size']
+
+ @property
def size(self) -> Optional[float]:
for i in range(storage['DISK_RETRY_ATTEMPTS']):
self.partprobe()