Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 24 lines (20 sloc) 734 Bytes
#!/bin/sh
#
# writes a condition: 'virtual', which can be:
# - 'physical' if a physical machine
# - 'vmware' if a VMware VM
# - 'parallels' if a Parallels VM
#
# Designed to be analogous to the 'virtual' Facter fact:
# https://github.com/puppetlabs/facter/blob/master/lib/facter/virtual.rb
DEFAULTS=/usr/bin/defaults
MUNKI_DIR=$("${DEFAULTS}" read /Library/Preferences/ManagedInstalls ManagedInstallDir)
COND_DOMAIN="${MUNKI_DIR}/ConditionalItems"
KEY="virtual"
VALUE="physical"
if system_profiler SPHardwareDataType | grep Boot\ ROM | grep VMW; then
VALUE="vmware"
elif system_profiler SPEthernetDataType | grep Vendor\ ID:\ 0x1ab8; then
VALUE="parallels"
fi
"${DEFAULTS}" write "${COND_DOMAIN}" "${KEY}" "${VALUE}"