From 919e48001d01d00dce08aaa1714611dfbe5ab922 Mon Sep 17 00:00:00 2001 From: Mark Ruys Date: Mon, 27 Jul 2015 12:38:13 +0200 Subject: [PATCH] More reliable and often faster check to determine virtualization. --- include/functions | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/functions b/include/functions index d2db98ce..ff9591db 100644 --- a/include/functions +++ b/include/functions @@ -590,6 +590,19 @@ # 0 = no, 1 = yes, 2 = unknown ISVIRTUALMACHINE=2; VMTYPE="unknown"; VMFULLTYPE="Unknown" + # Trying facter + if [ -x /usr/bin/facter ]; then + case "`facter is_virtual`" in + "true") + VMTYPE=`facter virtual` + logtext "Result: found virtual machine (type: ${VMTYPE})" + report "vm=1" + report "vmtype=${VMTYPE}" + return ;; + "false") return ;; + esac + fi + SHORT="" # Trying systemd @@ -601,6 +614,13 @@ fi fi + # # dmidecode + # if [ "${SHORT}" = "" ]; then + # if [ -x /usr/sbin/dmidecode ]; then + # SHORT=`dmidecode -s system-product-name` + # fi + # fi + # lshw if [ "${SHORT}" = "" ]; then if [ -x /usr/bin/lshw ]; then