Skip to content

Instantly share code, notes, and snippets.

@timsutton
Created February 24, 2014 19:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsutton/9195541 to your computer and use it in GitHub Desktop.
Save timsutton/9195541 to your computer and use it in GitHub Desktop.
Start of a VirtualBox OS X Packer template.
Two main issues:
1) Packer currently always uses an IDE storage controller, but in VBox only a SATA DVD image seems to be useful to boot the installer.
2) The disk device in the guest shows up as removable drive rather than an internal SATA, and this seems to confuse AutoPartition.app and make it not see a drive to partition. I'm not sure if there are some options that could be passed to AutoPartition to make it see the drive as partition-able. This is just one more reason why switching to some auto-partitioning shell code in /etc/rc.common might be better off than relying on AutoPartition.
{
"builders": [
{
"boot_wait": "2s",
"disk_size": 20480,
"guest_additions_mode": "disable",
"guest_os_type": "MacOS109_64",
"hard_drive_interface": "sata",
"iso_checksum_type": "md5",
"iso_checksum": "7d37202d7331410792dac965df363d2c",
"iso_url": "file:///Users/Shared/OSX_InstallESD_10.9.1_13B42.dmg",
"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}}", "--firmware", "efi"],
["modifyvm", "{{.Name}}", "--hpet", "on"],
["modifyvm", "{{.Name}}", "--keyboard", "usb"],
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--mouse", "usbtablet"],
["modifyvm", "{{.Name}}", "--vram", "9"]
]
}
],
"post-processors": [
"vagrant"
],
"provisioners": [
{
"destination": "/private/tmp/kcpassword",
"source": "../scripts/support/kcpassword",
"type": "file"
},
{
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"scripts": [
"../scripts/vagrant.sh",
"../scripts/vmware.sh",
"../scripts/xcode-cli-tools.sh",
"../scripts/chef-omnibus.sh",
"../scripts/puppet.sh"
],
"type": "shell"
},
{
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .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": {
"autologin_vagrant_user": ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment