mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix usage of systemd-detect-virt on baremetal
This commit is contained in:
parent
9ebb3102cd
commit
8cb2640872
1 changed files with 9 additions and 2 deletions
|
@ -17,13 +17,20 @@ class BaseSystemDiagnoser(Diagnoser):
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
# Detect virt technology (if not bare metal) and arch
|
# Detect virt technology (if not bare metal) and arch
|
||||||
# Also possibly the board name
|
# Gotta have this "|| true" because it systemd-detect-virt return 'none'
|
||||||
virt = check_output("systemd-detect-virt").strip() or "bare-metal"
|
# with an error code on bare metal ~.~
|
||||||
|
virt = check_output("systemd-detect-virt || true", shell=True).strip()
|
||||||
|
if virt.lower() == "none":
|
||||||
|
virt = "bare-metal"
|
||||||
|
|
||||||
|
# Detect arch
|
||||||
arch = check_output("dpkg --print-architecture").strip()
|
arch = check_output("dpkg --print-architecture").strip()
|
||||||
hardware = dict(meta={"test": "hardware"},
|
hardware = dict(meta={"test": "hardware"},
|
||||||
status="INFO",
|
status="INFO",
|
||||||
data={"virt": virt, "arch": arch},
|
data={"virt": virt, "arch": arch},
|
||||||
summary="diagnosis_basesystem_hardware")
|
summary="diagnosis_basesystem_hardware")
|
||||||
|
|
||||||
|
# Also possibly the board name
|
||||||
if os.path.exists("/proc/device-tree/model"):
|
if os.path.exists("/proc/device-tree/model"):
|
||||||
model = read_file('/proc/device-tree/model').strip()
|
model = read_file('/proc/device-tree/model').strip()
|
||||||
hardware["data"]["model"] = model
|
hardware["data"]["model"] = model
|
||||||
|
|
Loading…
Add table
Reference in a new issue