diff --git a/data/hooks/diagnosis/00-basesystem.py b/data/hooks/diagnosis/00-basesystem.py index 4add48fb2..bf7a27047 100644 --- a/data/hooks/diagnosis/00-basesystem.py +++ b/data/hooks/diagnosis/00-basesystem.py @@ -2,6 +2,7 @@ import os +from moulinette.utils.process import check_output from moulinette.utils.filesystem import read_file from yunohost.diagnosis import Diagnoser from yunohost.utils.packages import ynh_packages_version @@ -15,14 +16,27 @@ class BaseSystemDiagnoser(Diagnoser): def run(self): + # Detect virt technology (if not bare metal) and arch + # Also possibly the board name + virt = check_output("systemd-detect-virt").strip() or "bare-metal" + arch = check_output("dpkg --print-architecture").strip() + hardware = dict(meta={"test": "hardware"}, + status="INFO", + data={"virt": virt, "arch": arch}, + summary=("diagnosis_basesystem_hardware", {"virt": virt, "arch": arch})) + if os.path.exists("/proc/device-tree/model"): + model = read_file('/proc/device-tree/model').strip() + hardware["data"]["board"] = model + hardware["details"] = [("diagnosis_basesystem_hardware_board", (model,))] + + yield hardware + # Kernel version kernel_version = read_file('/proc/sys/kernel/osrelease').strip() yield dict(meta={"test": "kernel"}, status="INFO", summary=("diagnosis_basesystem_kernel", {"kernel_version": kernel_version})) - # FIXME / TODO : add virt/vm technology using systemd-detect-virt and/or machine arch - # Debian release debian_version = read_file("/etc/debian_version").strip() yield dict(meta={"test": "host"}, diff --git a/locales/en.json b/locales/en.json index d70f964d2..82be4003a 100644 --- a/locales/en.json +++ b/locales/en.json @@ -142,7 +142,9 @@ "confirm_app_install_danger": "DANGER! This app is known to be still experimental (if not explicitly not working)! You should probably NOT install it unless you know what you are doing. NO SUPPORT will be provided if this app doesn't work or breaks your system… If you are willing to take that risk anyway, type '{answers:s}'", "confirm_app_install_thirdparty": "DANGER! This app is not part of Yunohost's app catalog. Installing third-party apps may compromise the integrity and security of your system. You should probably NOT install it unless you know what you are doing. NO SUPPORT will be provided if this app doesn't work or breaks your system… If you are willing to take that risk anyway, type '{answers:s}'", "custom_app_url_required": "You must provide a URL to upgrade your custom app {app:s}", - "diagnosis_basesystem_host": "Server is running Debian {debian_version}.", + "diagnosis_basesystem_hardware": "Server hardware architecture is {virt} {arch}", + "diagnosis_basesystem_hardware_board": "Server board model is {model}", + "diagnosis_basesystem_host": "Server is running Debian {debian_version}", "diagnosis_basesystem_kernel": "Server is running Linux kernel {kernel_version}", "diagnosis_basesystem_ynh_single_version": "{0} version: {1} ({2})", "diagnosis_basesystem_ynh_main_version": "Server is running YunoHost {main_version} ({repo})",