index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2021-05-10 19:21:05 +0200 |
---|---|---|
committer | Anton Hvornum <anton@hvornum.se> | 2021-05-10 19:21:05 +0200 |
commit | dd52bfb3a7f6f7a150e46f7c99d538e26de60276 (patch) | |
tree | bab058d1ebd323fccf45bd5acf8d324b894ea529 /archinstall/lib/disk.py | |
parent | 4aaaa3208bedc110cef4b4545031e8e43103161a (diff) |
-rw-r--r-- | archinstall/lib/disk.py | 10 |
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index dd704261..ab3560a9 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -152,6 +152,16 @@ class BlockDevice(): for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']: return partition.get('uuid', None) + @property + def size(self): + output = b"".join(sys_command(f"lsblk --json -o+SIZE {self.path}")) + output = json.loads(output.decode('UTF-8')) + + for device in output['blockdevices']: + assert device['size'][-1] == 'G' # Make sure we're counting in Gigabytes, otherwise the next logic fails. + + return float(device['size'][:-1]) + def has_partitions(self): return len(self.partitions) |