Browse Source

Corrected virtualization detection in system-info.sh. (#9425)

This causes failure to detect virtualization to be reported as no
virtualization instead of unknown virtulization.
Austin S. Hemmelgarn 4 years ago
parent
commit
5d21a9d542
1 changed files with 5 additions and 7 deletions
  1. 5 7
      daemon/system-info.sh

+ 5 - 7
daemon/system-info.sh

@@ -23,13 +23,11 @@ if [ -z "${VIRTUALIZATION}" ]; then
             if grep -q "^flags.*hypervisor" /proc/cpuinfo 2>/dev/null; then
                     VIRTUALIZATION="hypervisor"
                     VIRT_DETECTION="/proc/cpuinfo"
-            elif [ -n "$(command -v dmidecode)" ]; then
-                    # Virtualization detection from https://unix.stackexchange.com/questions/89714/easy-way-to-determine-virtualization-technology
-                    # This only works as root
-                    if dmidecode -s system-product-name 2>/dev/null | grep -q "VMware\|Virtual\|KVM\|Bochs"; then
-                            VIRTUALIZATION="$(dmidecode -s system-product-name)"
-                            VIRT_DETECTION="dmidecode"
-                    fi
+            elif [ -n "$(command -v dmidecode)" ] && dmidecode -s system-product-name 2>/dev/null | grep -q "VMware\|Virtual\|KVM\|Bochs"; then
+                    VIRTUALIZATION="$(dmidecode -s system-product-name)"
+                    VIRT_DETECTION="dmidecode"
+            else
+                    VIRTUALIZATION="none"
             fi
     fi
 else