Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-06-11 21:33:37 +0200
committerAnton Hvornum <anton@hvornum.se>2021-06-11 21:33:37 +0200
commitba60d82bb91fcbcb1ae168709812bf0b71c35523 (patch)
treeaf2aaca1fe6adc09c36cc7644bce3027546cf5fa /archinstall/lib/disk.py
parent24476ac1f696c882fb2f741cb8c5fa858f786f46 (diff)
Added BlockDevice.spinning and BlockDevice.bus_type
Diffstat (limited to 'archinstall/lib/disk.py')
-rw-r--r--archinstall/lib/disk.py14
1 files changed, 14 insertions, 0 deletions
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)