availability: January 2017
This probably falls in the category of useless automation for a lot of people. In my never ending search for automation , I wondered how far vmware fusion could be automated.
The first step is to download the Vmware Fusion disk image. Because this requires registration, this can't be automated:
You can download vmware fusion from the vmware website URL
This will propose you two options:
I suggest downloading the Option1 , as it includes the OVF Tools which I find handy for importing ovf format virtual machines
New machines are created in : $HOME/Documents/Virtual Machines.localized
<% codify(:shell) do %>
VMFUSION_DMG="$HOME/SavedDownloads/VMware-Fusion-3.1.1-282344.dmg"
VMFUSION_MOUNT_POINT=$( hdiutil mount $VMFUSION_DMG -nobrowse |tail -1|cut -d ' ' -f 2-|cut -d '/' -f 2-) echo $VMFUSION_MOUNT_POINT
sudo installer -pkg "$VMFUSION_MOUNT_POINT/Install VMware Fusion.app/Contents/Resources/Install VMware Fusion.mpkg/Contents/Packages/Install VMware Fusion.pkg" -target / sudo installer -pkg "$VMFUSION_MOUNT_POINT/Install VMware Fusion.app/Contents/Resources/Install VMware Fusion.mpkg/Contents/Packages/com.vmware.fusion.ovftool.pkg" -target /
hdiutil unmount "$VMFUSION_MOUNT_POINT"
pkgutil --pkgs=com.vmware.*
#com.vmware.fusion.antivirus.windows
#com.vmware.fusion.application
#com.vmware.fusion.ovftool
#com.vmware.fusion.tools.darwin
#com.vmware.fusion.tools.freebsd
#com.vmware.fusion.tools.linux
#com.vmware.fusion.tools.netware
#com.vmware.fusion.tools.solaris
#com.vmware.fusion.tools.windows
#com.vmware.fusion.tools.winPre2k
VMFUSION_SERIALNR="
/Library/Application\ Support/VMware\ Fusion/vmware-licenseTool check "$VMFUSION_SERIALNR" $VMFUSION_VERSION "Vmware Fusion for Mac OS" ""
sudo /Library/Application\ Support/VMware\ Fusion/vmware-licenseTool enter "$VMFUSION_SERIALNR" "$VMFUSION_NAME" "$VMFUSION_COMPANY" $VMFUSION_VERSION "Vmware Fusion for Mac OS" ""
cat /Library/Application\ Support/VMware\ Fusion/license-*
ls /Applications/VMware\ Fusion.app/Contents/MacOS/vmware
ls /Library/Application\ Support/VMware\ Fusion
ls $HOME/Documents/Virtual\ Machines.localized
sudo sh -c "/Library/Application\ Support/VMware\ Fusion/boot.sh --restart"
<% end %>
<% codify(:shell) do %>
#Find the vmware packages installed pkgutil --pkgs=com.vmware.fusion.*
sudo sh -c "cd /Library/Application\ Support/VMware\ Fusion/ ; test -f boot.sh && ./boot.sh --stop"
FUSION_PID=$(ps -eo pid,command |grep -i "/Applications/VMware Fusion.app/Contents/MacOS/vmware"|grep -v grep| sed -e "s/^[ ]*//"|cut -d ' ' -f 1) echo $FUSION_PID kill $FUSION_PID
FUSION_PID=$(ps -eo pid,command |grep -i "vmrun"|grep -v grep| sed -e "s/^[ ]*//"|cut -d ' ' -f 1) echo $FUSION_PID kill $FUSION_PID
FUSION_PID=$(ps -eo pid,command |grep -i "vmware-vmx"|grep -v grep| sed -e "s/^[ ]*//"|cut -d ' ' -f 1) echo $FUSION_PID kill $FUSION_PID
FUSION_PID=$(ps -eo pid,command |grep -i "/Library/Application Support/VMware Fusion/"|grep -v grep| sed -e "s/^[ ]*//"|cut -d ' ' -f 1) echo $FUSION_PID kill $FUSION_PID
sleep 2
pkgutil --pkg-info com.vmware.fusion.application 2>/dev/null| grep -i ^version
for pkg in pkgutil --pkgs=com.vmware.fusion.*
; do sudo pkgutil --verbose --unlink $pkg -f; done
for pkg in pkgutil --pkgs=com.vmware.fusion.*
; do sudo pkgutil --verbose --forget $pkg -f; done "
sudo /Library/Application\ Support/VMware\ Fusion/Uninstall\ VMware\ Fusion.app/Contents/Resources/fusion-uninstaller.tool
<% end %>