commit
bf18260510
|
|
@ -63,17 +63,20 @@ def has_wifi() -> bool:
|
||||||
|
|
||||||
|
|
||||||
def has_amd_cpu() -> bool:
|
def has_amd_cpu() -> bool:
|
||||||
if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode():
|
try:
|
||||||
return True
|
return subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def has_intel_cpu() -> bool:
|
def has_intel_cpu() -> bool:
|
||||||
if subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode():
|
try:
|
||||||
return True
|
return subprocess.check_output("lscpu | grep Intel", shell=True).strip().decode()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def has_uefi() -> bool:
|
def has_uefi() -> bool:
|
||||||
return os.path.isdir('/sys/firmware/efi')
|
return os.path.isdir('/sys/firmware/efi')
|
||||||
|
|
||||||
|
|
@ -106,7 +109,7 @@ def cpu_vendor() -> Optional[str]:
|
||||||
for info in cpu_info:
|
for info in cpu_info:
|
||||||
if info.get('field', None) == "Vendor ID:":
|
if info.get('field', None) == "Vendor ID:":
|
||||||
return info.get('data', None)
|
return info.get('data', None)
|
||||||
return None
|
return
|
||||||
|
|
||||||
|
|
||||||
def cpu_model() -> Optional[str]:
|
def cpu_model() -> Optional[str]:
|
||||||
|
|
@ -116,7 +119,7 @@ def cpu_model() -> Optional[str]:
|
||||||
for info in cpu_info:
|
for info in cpu_info:
|
||||||
if info.get('field', None) == "Model name:":
|
if info.get('field', None) == "Model name:":
|
||||||
return info.get('data', None)
|
return info.get('data', None)
|
||||||
return None
|
return
|
||||||
|
|
||||||
|
|
||||||
def sys_vendor() -> Optional[str]:
|
def sys_vendor() -> Optional[str]:
|
||||||
|
|
@ -154,13 +157,6 @@ def virtualization() -> Optional[str]:
|
||||||
|
|
||||||
|
|
||||||
def is_vm() -> bool:
|
def is_vm() -> bool:
|
||||||
try:
|
return b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower()
|
||||||
# systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
|
|
||||||
if b"none" not in b"".join(SysCommand("systemd-detect-virt")).lower():
|
|
||||||
return True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
# TODO: Add more identifiers
|
# TODO: Add more identifiers
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue