Enabled dmidecode for virtualization detection

This commit is contained in:
mboelen 2015-09-05 18:41:04 +02:00
parent 2fd7788b9b
commit 461920ff72

View File

@ -589,8 +589,9 @@
logtext "Test: Determine if this system is a virtual machine" logtext "Test: Determine if this system is a virtual machine"
# 0 = no, 1 = yes, 2 = unknown # 0 = no, 1 = yes, 2 = unknown
ISVIRTUALMACHINE=2; VMTYPE="unknown"; VMFULLTYPE="Unknown" ISVIRTUALMACHINE=2; VMTYPE="unknown"; VMFULLTYPE="Unknown"
SHORT=""
# Trying facter # facter
if [ -x /usr/bin/facter ]; then if [ -x /usr/bin/facter ]; then
case "`facter is_virtual`" in case "`facter is_virtual`" in
"true") "true")
@ -603,9 +604,7 @@
esac esac
fi fi
SHORT="" # systemd
# Trying systemd
if [ "${SHORT}" = "" -a ! "${SYSTEMCTLBINARY}" = "" ]; then if [ "${SHORT}" = "" -a ! "${SYSTEMCTLBINARY}" = "" ]; then
logtext "Test: trying to guess virtualization technology with systemctl" logtext "Test: trying to guess virtualization technology with systemctl"
FIND=`${SYSTEMCTLBINARY} | grep "^Virtualization=" | awk -F= '{ print $2 }'` FIND=`${SYSTEMCTLBINARY} | grep "^Virtualization=" | awk -F= '{ print $2 }'`
@ -614,12 +613,14 @@
fi fi
fi fi
# # dmidecode # dmidecode
# if [ "${SHORT}" = "" ]; then # Values: VMware Virtual Platform / VirtualBox
# if [ -x /usr/sbin/dmidecode ]; then if [ "${SHORT}" = "" ]; then
# SHORT=`dmidecode -s system-product-name` logtext "Test: trying to guess virtualization with dmidecode"
# fi if [ -x /usr/sbin/dmidecode ]; then
# fi SHORT=`dmidecode -s system-product-name | awk '{ print $1 }'`
fi
fi
# lshw # lshw
if [ "${SHORT}" = "" ]; then if [ "${SHORT}" = "" ]; then
@ -663,7 +664,7 @@
# Check if we catched some string along all tests # Check if we catched some string along all tests
if [ ! "${SHORT}" = "" ]; then if [ ! "${SHORT}" = "" ]; then
# Lowercase and see if we found a match # Lowercase and see if we found a match
SHORT=`echo ${SHORT} | tr [[:upper:]] [[:lower:]]` SHORT=`echo ${SHORT} | awk '{ print $1 }' | tr [[:upper:]] [[:lower:]]`
case ${SHORT} in case ${SHORT} in
amazon-ec2) ISVIRTUALMACHINE=1; VMTYPE="amazon-ec2"; VMFULLTYPE="Amazon AWS EC2 Instance" ;; amazon-ec2) ISVIRTUALMACHINE=1; VMTYPE="amazon-ec2"; VMFULLTYPE="Amazon AWS EC2 Instance" ;;