Skip to content

Commit

Permalink
Merge pull request #389 from chef/refactor-mac-templates
Browse files Browse the repository at this point in the history
[macosx-*] Improve DRYness & correctness of Mac templates.
  • Loading branch information
fnichol committed Jul 3, 2015
2 parents 766eb08 + 245ae54 commit 13d9182
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 190 deletions.
51 changes: 19 additions & 32 deletions macosx-10.10.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"disk_size": 20480,
"guest_os_type": "darwin12-64",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "md5",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"output_directory": "packer-macosx-10.10-vmware",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now",
"output_directory": "packer-{{user `template`}}-vmware",
"shutdown_command": "echo 'vagrant'| sudo -S shutdown -h now",
"skip_compaction": true,
"ssh_password": "vagrant",
"ssh_port": 22,
Expand All @@ -17,7 +17,7 @@
"tools_upload_flavor": "darwin",
"tools_upload_path": "/tmp/vmtools.iso",
"type": "vmware-iso",
"vm_name": "packer-macosx-10.10-vmware",
"vm_name": "packer-{{user `template`}}-vmware",
"vmx_data": {
"cpuid.coresPerSocket": "1",
"ehci.present": "TRUE",
Expand All @@ -38,10 +38,10 @@
"guest_os_type": "MacOS109_64",
"hard_drive_interface": "sata",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "md5",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"output_directory": "packer-macosx-10.10-virtualbox",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now",
"output_directory": "packer-{{user `template`}}-virtualbox",
"shutdown_command": "echo 'vagrant'| sudo -S shutdown -h now",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_username": "vagrant",
Expand Down Expand Up @@ -149,10 +149,10 @@
]
],
"virtualbox_version_file": ".vbox_version",
"vm_name": "packer-macosx-10.10-virtualbox"
"vm_name": "packer-{{user `template`}}-virtualbox"
}
],
"min_packer_version": "0.6.0",
"min_packer_version": "0.7.0",
"post-processors": [
{
"output": "builds/{{user `box_basename`}}.{{.Provider}}.box",
Expand All @@ -167,12 +167,10 @@
"type": "file"
},
{
"destination": "/private/tmp/kcpassword",
"source": "scripts/macosx/support/kcpassword",
"type": "file"
},
{
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -E -S sh '{{.Path}}'",
"environment_vars": [
"HOME_DIR=/Users/vagrant"
],
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -S -E sh -eux '{{.Path}}'",
"scripts": [
"scripts/common/metadata.sh",
"scripts/macosx/hostname.sh",
Expand All @@ -184,31 +182,20 @@
"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",
"_README": "You must provide a prepared Mac disk image (from https://github.com/timsutton/osx-vm-templates) and checksum value for this template to work. For more details, consult this project's README.md",
"box_basename": "__unset_box_basename__",
"build_timestamp": "{{isotime \"20060102150405\"}}",
"git_revision": "__unknown_git_revision__",
"iso_checksum": "6d878aeb58aad23d2be00774d4da3b3d",
"iso_checksum": "__unset_iso_checksum__",
"iso_checksum_type": "md5",
"iso_url": "http://fakeurl/OSX_InstallESD_10.10.3_14D136.dmg",
"iso_url": "http://YOU-MUST-PROVIDE-YOUR-OWN-DMG.sorry",
"metadata": "floppy/dummy_metadata.json",
"name": "macosx-10.10",
"name": "chef/macosx-10.10",
"template": "macosx-10.10",
"version": "2.0.TIMESTAMP"
"version": "2.1.TIMESTAMP"
}
}

60 changes: 25 additions & 35 deletions macosx-10.7.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
"disk_size": 20480,
"guest_os_type": "darwin12-64",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "md5",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"output_directory": "packer-macosx-10.7-vmware",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now",
"output_directory": "packer-{{user `template`}}-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",
"tools_upload_path": "/tmp/vmtools.iso",
"type": "vmware-iso",
"vm_name": "packer-macosx-10.7-vmware",
"vm_name": "packer-{{user `template`}}-vmware",
"vmx_data": {
"cpuid.coresPerSocket": "1",
"ehci.present": "TRUE",
Expand All @@ -38,10 +38,10 @@
"guest_os_type": "MacOS107_64",
"hard_drive_interface": "sata",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "md5",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"output_directory": "packer-macosx-10.7-virtualbox",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now",
"output_directory": "packer-{{user `template`}}-virtualbox",
"shutdown_command": "echo 'vagrant'| sudo -S shutdown -h now",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_username": "vagrant",
Expand Down Expand Up @@ -149,10 +149,10 @@
]
],
"virtualbox_version_file": ".vbox_version",
"vm_name": "packer-macosx-10.7-virtualbox"
"vm_name": "packer-{{user `template`}}-virtualbox"
}
],
"min_packer_version": "0.6.0",
"min_packer_version": "0.7.0",
"post-processors": [
{
"output": "builds/{{user `box_basename`}}.{{.Provider}}.box",
Expand All @@ -167,45 +167,35 @@
"type": "file"
},
{
"destination": "/private/tmp/kcpassword",
"source": "scripts/macosx/support/kcpassword",
"type": "file"
},
{
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -E -S sh '{{.Path}}'",
"environment_vars": [
"HOME_DIR=/Users/vagrant"
],
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -S -E sh -eux '{{.Path}}'",
"scripts": [
"scripts/common/metadata.sh",
"scripts/macosx/hostname.sh",
"scripts/macosx/builder.sh",
"scripts/macosx/update.sh",
"scripts/macosx/networking.sh",
"scripts/macosx/vagrant.sh",
"scripts/macosx/cleanup.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"
"scripts/macosx/vmtools.sh",
"scripts/macosx/cleanup.sh",
"scripts/macosx/minimize.sh"
],
"type": "shell"
}
],
"variables": {
"arch": "64",
"autologin_vagrant_user": "",
"box_basename": "macosx-10.7",
"_README": "You must provide a prepared Mac disk image (from https://github.com/timsutton/osx-vm-templates) and checksum value for this template to work. For more details, consult this project's README.md",
"box_basename": "__unset_box_basename__",
"build_timestamp": "{{isotime \"20060102150405\"}}",
"git_revision": "__unknown_git_revision__",
"iso_checksum": "e2a48af008ff3c4db6a8235151a1e90ea600fceb",
"iso_url": "http://fakeurl/OSX_InstallESD_10.7.5_11G63.dmg",
"iso_checksum": "__unset_iso_checksum__",
"iso_checksum_type": "md5",
"iso_url": "http://YOU-MUST-PROVIDE-YOUR-OWN-DMG.sorry",
"metadata": "floppy/dummy_metadata.json",
"name": "macosx-10.7",
"name": "chef/macosx-10.7",
"template": "macosx-10.7",
"version": "2.0.TIMESTAMP"
"version": "2.1.TIMESTAMP"
}
}

60 changes: 25 additions & 35 deletions macosx-10.8.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
"disk_size": 20480,
"guest_os_type": "darwin12-64",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "md5",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"output_directory": "packer-macosx-10.8-vmware",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now",
"output_directory": "packer-{{user `template`}}-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",
"tools_upload_path": "/tmp/vmtools.iso",
"type": "vmware-iso",
"vm_name": "packer-macosx-10.8-vmware",
"vm_name": "packer-{{user `template`}}-vmware",
"vmx_data": {
"cpuid.coresPerSocket": "1",
"ehci.present": "TRUE",
Expand All @@ -38,10 +38,10 @@
"guest_os_type": "MacOS108_64",
"hard_drive_interface": "sata",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "md5",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"output_directory": "packer-macosx-10.8-virtualbox",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -h now",
"output_directory": "packer-{{user `template`}}-virtualbox",
"shutdown_command": "echo 'vagrant'| sudo -S shutdown -h now",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_username": "vagrant",
Expand Down Expand Up @@ -149,10 +149,10 @@
]
],
"virtualbox_version_file": ".vbox_version",
"vm_name": "packer-macosx-10.8-virtualbox"
"vm_name": "packer-{{user `template`}}-virtualbox"
}
],
"min_packer_version": "0.6.0",
"min_packer_version": "0.7.0",
"post-processors": [
{
"output": "builds/{{user `box_basename`}}.{{.Provider}}.box",
Expand All @@ -167,45 +167,35 @@
"type": "file"
},
{
"destination": "/private/tmp/kcpassword",
"source": "scripts/macosx/support/kcpassword",
"type": "file"
},
{
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -E -S sh '{{.Path}}'",
"environment_vars": [
"HOME_DIR=/Users/vagrant"
],
"execute_command": "echo 'vagrant'| {{.Vars}} sudo -S -E sh -eux '{{.Path}}'",
"scripts": [
"scripts/common/metadata.sh",
"scripts/macosx/hostname.sh",
"scripts/macosx/builder.sh",
"scripts/macosx/update.sh",
"scripts/macosx/networking.sh",
"scripts/macosx/vagrant.sh",
"scripts/macosx/cleanup.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"
"scripts/macosx/vmtools.sh",
"scripts/macosx/cleanup.sh",
"scripts/macosx/minimize.sh"
],
"type": "shell"
}
],
"variables": {
"arch": "64",
"autologin_vagrant_user": "",
"box_basename": "macosx-10.8",
"_README": "You must provide a prepared Mac disk image (from https://github.com/timsutton/osx-vm-templates) and checksum value for this template to work. For more details, consult this project's README.md",
"box_basename": "__unset_box_basename__",
"build_timestamp": "{{isotime \"20060102150405\"}}",
"git_revision": "__unknown_git_revision__",
"iso_checksum": "e2a48af008ff3c4db6a8235151a1e90ea600fceb",
"iso_url": "http://fakeurl/OSX_InstallESD_10.8.5_12F45.dmg",
"iso_checksum": "__unset_iso_checksum__",
"iso_checksum_type": "md5",
"iso_url": "http://YOU-MUST-PROVIDE-YOUR-OWN-DMG.sorry",
"metadata": "floppy/dummy_metadata.json",
"name": "macosx-10.8",
"name": "chef/macosx-10.8",
"template": "macosx-10.8",
"version": "2.0.TIMESTAMP"
"version": "2.1.TIMESTAMP"
}
}

Loading

0 comments on commit 13d9182

Please sign in to comment.