Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/hardware.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-04-07 11:40:28 +0000
committerGitHub <noreply@github.com>2021-04-07 11:40:28 +0000
commit04bc9ce05f6c86e0c3e3e97ed4734165b9482472 (patch)
tree89c7d1ba647cc135a04fc288c3e0cf2216f8abb8 /archinstall/lib/hardware.py
parent42470dcc9ae13fca5f46d0f8e1be800744a8a797 (diff)
parentd9480ee8a085409145de0d0fa4457ee2e144c444 (diff)
Merge pull request #217 from advaithm/torxed-v2.2.0
added isVM function
Diffstat (limited to 'archinstall/lib/hardware.py')
-rw-r--r--archinstall/lib/hardware.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index 687b4a74..3da333de 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -41,4 +41,12 @@ def cpuVendor()-> Optional[str]:
if info.get('field',None):
if info.get('field',None) == "Vendor ID:":
return info.get('data',None)
+
+def isVM() -> bool:
+ try:
+ subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a none 0 exit code if it is not on a virtual machine
+ return True
+ except:
+ return False
+
# TODO: Add more identifiers