From ba60d82bb91fcbcb1ae168709812bf0b71c35523 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 11 Jun 2021 21:33:37 +0200 Subject: Added BlockDevice.spinning and BlockDevice.bus_type --- archinstall/lib/disk.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'archinstall/lib') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 7a7fce5e..153ee428 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -174,6 +174,20 @@ class BlockDevice: return float(device['size'][:-1]) + @property + def bus_type(self): + output = json.loads(SysCommand(f"lsblk --json -o+ROTA,TRAN {self.path}").decode('UTF-8')) + + for device in output['blockdevices']: + return device['tran'] + + @property + def spinning(self): + output = json.loads(SysCommand(f"lsblk --json -o+ROTA,TRAN {self.path}").decode('UTF-8')) + + for device in output['blockdevices']: + return device['rota'] is True + def has_partitions(self): return len(self.partitions) -- cgit v1.2.3-70-g09d2