From c264fd466aca54bcc1a7210165ee143b5f0aa6f3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 22 Nov 2021 09:33:00 +0000 Subject: Fix #746 - Can't create a filesystem on a new partition during the manual partitioning (#751) * Changed default value of info in largest_free_space() * Fixing bad assumption that a disk always contain a minimum of two partitions. --- archinstall/lib/disk/blockdevice.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'archinstall/lib/disk/blockdevice.py') diff --git a/archinstall/lib/disk/blockdevice.py b/archinstall/lib/disk/blockdevice.py index 307c5983..b3195784 100644 --- a/archinstall/lib/disk/blockdevice.py +++ b/archinstall/lib/disk/blockdevice.py @@ -192,7 +192,7 @@ class BlockDevice: @property def largest_free_space(self): - info = None + info = [] for space_info in self.free_space: if not info: info = space_info @@ -202,6 +202,22 @@ class BlockDevice: info = space_info return info + @property + def first_free_sector(self): + if info := self.largest_free_space: + start = info[0] + else: + start = '512MB' + return start + + @property + def first_end_sector(self): + if info := self.largest_free_space: + end = info[1] + else: + end = f"{self.size}GB" + return end + def partprobe(self): SysCommand(['partprobe', self.path]) -- cgit v1.2.3-54-g00ecf