forked from timsutton/osx-vm-templates
-
Notifications
You must be signed in to change notification settings - Fork 3
/
vmware.sh
executable file
·32 lines (26 loc) · 1.05 KB
/
vmware.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
TOOLS_PATH="/Users/$USERNAME/darwin.iso"
# VMware Fusion specific items
if [ -e .vmfusion_version ] || [[ "$PACKER_BUILDER_TYPE" == vmware* ]]; then
if [ ! -e "$TOOLS_PATH" ]; then
echo "Couldn't locate uploaded tools iso at $TOOLS_PATH!"
exit 1
fi
TMPMOUNT=`/usr/bin/mktemp -d /tmp/vmware-tools.XXXX`
hdiutil attach "$TOOLS_PATH" -mountpoint "$TMPMOUNT"
INSTALLER_PKG="$TMPMOUNT/Install VMware Tools.app/Contents/Resources/VMware Tools.pkg"
if [ ! -e "$INSTALLER_PKG" ]; then
echo "Couldn't locate VMware installer pkg at $INSTALLER_PKG!"
exit 1
fi
echo "Installing VMware tools.."
installer -pkg "$TMPMOUNT/Install VMware Tools.app/Contents/Resources/VMware Tools.pkg" -target /
# This usually fails
hdiutil detach "$TMPMOUNT"
rm -rf "$TMPMOUNT"
rm -f "$TOOLS_PATH"
# Point Linux shared folder root to that used by OS X guests,
# useful for the Hashicorp vmware_fusion Vagrant provider plugin
mkdir /mnt
ln -sf /Volumes/VMware\ Shared\ Folders /mnt/hgfs
fi