-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #384 from chef/rebase-pr-353
Add Mac OS X 10.10 template.
- Loading branch information
Showing
5 changed files
with
301 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"boot_wait": "2s", | ||
"disk_size": 20480, | ||
"guest_os_type": "darwin12-64", | ||
"iso_checksum": "{{user `iso_checksum`}}", | ||
"iso_checksum_type": "md5", | ||
"iso_url": "{{user `iso_url`}}", | ||
"output_directory": "packer-macosx-10.10-vmware", | ||
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now", | ||
"skip_compaction": true, | ||
"ssh_password": "vagrant", | ||
"ssh_port": 22, | ||
"ssh_username": "vagrant", | ||
"ssh_wait_timeout": "10000s", | ||
"tools_upload_flavor": "darwin", | ||
"tools_upload_path": "/tmp/vmtools.iso", | ||
"type": "vmware-iso", | ||
"vm_name": "packer-macosx-10.10-vmware", | ||
"vmx_data": { | ||
"cpuid.coresPerSocket": "1", | ||
"ehci.present": "TRUE", | ||
"firmware": "efi", | ||
"hpet0.present": "TRUE", | ||
"ich7m.present": "TRUE", | ||
"keyboardAndMouseProfile": "macProfile", | ||
"memsize": "2048", | ||
"numvcpus": "1", | ||
"smc.present": "TRUE", | ||
"usb.present": "TRUE" | ||
} | ||
}, | ||
{ | ||
"boot_wait": "2s", | ||
"disk_size": 20480, | ||
"guest_additions_mode": "disable", | ||
"guest_os_type": "MacOS109_64", | ||
"hard_drive_interface": "sata", | ||
"iso_checksum": "{{user `iso_checksum`}}", | ||
"iso_checksum_type": "md5", | ||
"iso_url": "{{user `iso_url`}}", | ||
"output_directory": "packer-macosx-10.10-virtualbox", | ||
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now", | ||
"ssh_password": "vagrant", | ||
"ssh_port": 22, | ||
"ssh_username": "vagrant", | ||
"ssh_wait_timeout": "10000s", | ||
"type": "virtualbox-iso", | ||
"vboxmanage": [ | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--audiocontroller", | ||
"hda" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--boot1", | ||
"dvd" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--boot2", | ||
"disk" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--chipset", | ||
"ich9" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--cpus", | ||
"1" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--firmware", | ||
"efi" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--hpet", | ||
"on" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--keyboard", | ||
"usb" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--memory", | ||
"2048" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--mouse", | ||
"usbtablet" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--vram", | ||
"9" | ||
], | ||
[ | ||
"storageattach", | ||
"{{.Name}}", | ||
"--storagectl", | ||
"SATA Controller", | ||
"--port", | ||
"1", | ||
"--type", | ||
"dvddrive", | ||
"--medium", | ||
"{{user `iso_url`}}" | ||
] | ||
], | ||
"vboxmanage_post": [ | ||
[ | ||
"storageattach", | ||
"{{.Name}}", | ||
"--storagectl", | ||
"SATA Controller", | ||
"--port", | ||
"1", | ||
"--type", | ||
"dvddrive", | ||
"--medium", | ||
"none" | ||
], | ||
[ | ||
"storagectl", | ||
"{{.Name}}", | ||
"--name", | ||
"IDE Controller", | ||
"--remove" | ||
] | ||
], | ||
"virtualbox_version_file": ".vbox_version", | ||
"vm_name": "packer-macosx-10.10-virtualbox" | ||
} | ||
], | ||
"min_packer_version": "0.6.0", | ||
"post-processors": [ | ||
{ | ||
"output": "builds/{{user `box_basename`}}.{{.Provider}}.box", | ||
"type": "vagrant", | ||
"vagrantfile_template": "vagrantfile_templates/macosx.rb" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"destination": "/tmp/bento-metadata.json", | ||
"source": "{{user `metadata`}}", | ||
"type": "file" | ||
}, | ||
{ | ||
"destination": "/private/tmp/kcpassword", | ||
"source": "scripts/macosx/support/kcpassword", | ||
"type": "file" | ||
}, | ||
{ | ||
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -E -S sh '{{.Path}}'", | ||
"scripts": [ | ||
"scripts/common/metadata.sh", | ||
"scripts/macosx/hostname.sh", | ||
"scripts/macosx/update.sh", | ||
"scripts/macosx/networking.sh", | ||
"scripts/macosx/vagrant.sh", | ||
"scripts/macosx/vmtools.sh", | ||
"scripts/macosx/cleanup.sh", | ||
"scripts/macosx/minimize.sh" | ||
], | ||
"type": "shell" | ||
}, | ||
{ | ||
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -E -S sh '{{.Path}}'", | ||
"inline": [ | ||
"[ -z \"{{user `autologin_vagrant_user`}}\" ] && exit", | ||
"echo \"Enabling automatic GUI login for the 'vagrant' user..\"", | ||
"cp /private/tmp/kcpassword /private/etc/kcpassword", | ||
"/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser vagrant" | ||
], | ||
"type": "shell" | ||
} | ||
], | ||
"variables": { | ||
"arch": "64", | ||
"autologin_vagrant_user": "", | ||
"box_basename": "macosx-10.10", | ||
"build_timestamp": "{{isotime \"20060102150405\"}}", | ||
"git_revision": "__unknown_git_revision__", | ||
"iso_checksum": "6d878aeb58aad23d2be00774d4da3b3d", | ||
"iso_checksum_type": "md5", | ||
"iso_url": "http://fakeurl/OSX_InstallESD_10.10.3_14D136.dmg", | ||
"metadata": "floppy/dummy_metadata.json", | ||
"name": "macosx-10.10", | ||
"template": "macosx-10.10", | ||
"version": "2.0.TIMESTAMP" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh -eux | ||
|
||
# disable swap | ||
launchctl unload -wF /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist; | ||
|
||
rm -f /private/var/vm/swapfile*; | ||
rm -f /private/var/vm/sleepimage; | ||
|
||
dd if=/dev/zero of=/EMPTY bs=1000000 || echo "dd exit code $? is suppressed"; | ||
rm -f /EMPTY; | ||
# Block until the empty file has been removed, otherwise, Packer | ||
# will try to kill the box while the disk is still full and that's bad | ||
sync; | ||
|
||
# re-enable swap | ||
launchctl load -wF /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
|
||
# Thank you to https://github.com/timsutton/osx-vm-templates | ||
# for the implementation | ||
|
||
# This script adds a Mac OS Launch Daemon, which runs every time the | ||
# machine is booted. The daemon will re-detect the attached network | ||
# interfaces. If this is not done, network devices may not work. | ||
PLIST=/Library/LaunchDaemons/com.github.timsutton.osx-vm-templates.detectnewhardware.plist | ||
cat <<EOF > "${PLIST}" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>com.github.timsutton.osx-vm-templates.detectnewhardware</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>/usr/sbin/networksetup</string> | ||
<string>-detectnewhardware</string> | ||
</array> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
</dict> | ||
</plist> | ||
EOF | ||
|
||
# These should be already set as follows, but since they're required | ||
# in order to load properly, we set them explicitly. | ||
/bin/chmod 644 "${PLIST}" | ||
/usr/sbin/chown root:wheel "${PLIST}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh -eux | ||
|
||
case "$PACKER_BUILDER_TYPE" in | ||
|
||
virtualbox-iso|virtualbox-ovf) | ||
echo "VirtualBox not currently supported, sadface"; | ||
;; | ||
|
||
vmware-iso|vmware-vmx) | ||
iso_name="/tmp/vmtools.iso"; | ||
mount_point="`mktemp -d /tmp/vmware-tools.XXXX`"; | ||
#Run install, unmount ISO and remove it | ||
hdiutil attach "$iso_name" -mountpoint "$mount_point"; | ||
installer -pkg "$mount_point/Install VMware Tools.app/Contents/Resources/VMware Tools.pkg" -target /; | ||
# This usually fails | ||
hdiutil detach "$mount_point" || true; | ||
rm -f "$iso_name"; | ||
rmdir "$mount_point"; | ||
|
||
# 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; | ||
;; | ||
|
||
parallels-iso|parallels-pvm) | ||
echo "Parallels not currently supported, sadface"; | ||
;; | ||
|
||
*) | ||
echo "Unknown Packer Builder Type >>${PACKER_BUILDER_TYPE}<< selected."; | ||
echo "Known are virtualbox-iso|virtualbox-ovf|vmware-iso|vmware-vmx|parallels-iso|parallels-pvm."; | ||
;; | ||
|
||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters