Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS X 10.10 support #353

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions packer/macosx-10.10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"min_packer_version": "0.6.0",
"variables": {
"autologin_vagrant_user": "",
"iso_url": "./OSX_InstallESD_10.10.3_14D136.dmg",
"iso_checksum": "6d878aeb58aad23d2be00774d4da3b3d",
"iso_checksum_type": "md5",
"chef_version": "provisionerless"
},
"provisioners": [
{
"type": "file",
"destination": "/private/tmp/kcpassword",
"source": "scripts/macosx/support/kcpassword"
},
{
"type": "shell",
"scripts": [
"scripts/macosx/hostname.sh",
"scripts/macosx/builder.sh",
"scripts/macosx/add-network-interface-detection.sh",
"scripts/macosx/update.sh",
"scripts/macosx/vagrant.sh",
"scripts/macosx/cleanup.sh"
],
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -E -S sh '{{.Path}}'"
},
{
"type": "shell",
"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"
],
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -E -S sh '{{.Path}}'"
}
],
"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": "/Users/vagrant/{{.Flavor}}.iso",
"type": "vmware-iso",
"vm_name": "packer-macosx-10.10-vmware",
"vmx_data": {
"cpuid.coresPerSocket": "1",
"memsize": "2048",
"numvcpus": "1",
"firmware": "efi",
"keyboardAndMouseProfile": "macProfile",
"smc.present": "TRUE",
"hpet0.present": "TRUE",
"ich7m.present": "TRUE",
"ehci.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",
"vm_name": "packer-macosx-10.10-virtualbox",
"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"
}
],
"post-processors": [
{
"type": "vagrant",
"vagrantfile_template": "vagrantfile_templates/macosx.rb",
"output": "../builds/{{.Provider}}/opscode_macosx-10.10_chef-{{user `chef_version`}}.box"
}
]
}
28 changes: 28 additions & 0 deletions packer/scripts/macosx/add-network-interface-detection.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

# 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}"
1 change: 1 addition & 0 deletions packer/vagrantfile_templates/macosx.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Vagrant.configure('2') do |config|
config.ssh.insert_key = false
config.vm.provider 'virtualbox' do |_, override|
override.vm.synced_folder '.', '/vagrant', type: 'rsync'
end
Expand Down