Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradvaithm <advaith.madhukar@gmail.com>2021-04-07 17:00:55 +0530
committeradvaithm <advaith.madhukar@gmail.com>2021-04-07 17:00:55 +0530
commitd9480ee8a085409145de0d0fa4457ee2e144c444 (patch)
tree56f8eecd2aac3a791644799db03b146931666186
parent86b4a5dc12908b27896e385bb0a51a69551e9482 (diff)
added isVM function
-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