Properly detect CPU on SmartOS(Maybe Solaris too).

Parsing was tested on a Genuine Intel CPU. Might fail on other CPU's.
This commit is contained in:
Pedro Algarvio 2013-01-27 19:28:14 +00:00
parent f0366e4783
commit abdb063f54

View file

@ -226,6 +226,11 @@ exec 2>$LOGPIPE
__gather_hardware_info() {
if [ -f /proc/cpuinfo ]; then
CPU_VENDOR_ID=$(cat /proc/cpuinfo | grep -E 'vendor_id|Processor' | head -n 1 | awk '{print $3}' | cut -d '-' -f1 )
elif [ -f /usr/sbin/psrinfo ]; then
# SmartOS.
# Solaris!?
# This has only been tested for a GenuineIntel CPU
CPU_VENDOR_ID=$( /usr/sbin/psrinfo -pv 0 | tail -n 2 | head -n 1 | cut -d ' ' -f6 | sed 's/[^A-Za-z0-9]//g' )
else
CPU_VENDOR_ID=$( sysctl -n hw.model )
fi