Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #26 from jdeathe/issue/25
Browse files Browse the repository at this point in the history
CLOSES #25: Adds support for Packer 1.0.0
  • Loading branch information
jdeathe authored Aug 8, 2017
2 parents d81f0b0 + ef17274 commit a7a4f03
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 95 deletions.
77 changes: 31 additions & 46 deletions CentOS-7-Minimal-Cloud-Init-virtualbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"ssh_user_home": "/home/centos",
"ssh_user_password": "centos",
"ssh_user_shell": "/bin/bash",
"ssh_user_sudo": "ALL=(ALL) NOPASSWD:ALL"
"ssh_user_sudo": "ALL=(ALL) NOPASSWD:ALL",
"vagrantfile_template": "CentOS-7.Vagrantfile"
},
"builders": [
{
Expand Down Expand Up @@ -114,57 +115,41 @@
"compression_level": 9,
"keep_input_artifact": true
},
[
{
"type": "artifice",
"files": [
"CentOS-7.Vagrantfile"
]
},
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\"",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ ! -d output-tmp ]]; then",
" mkdir output-tmp",
"fi",
"if [[ -n ${1} ]] && [[ -f ${1} ]]; then",
" echo '--> Generating Vagrantfile template.'",
" cp -pf ${1} output-tmp/${1}",
" sed -e 's~[{][{]user `ssh_user`[}][}]~{{user `ssh_user`}}~g' output-tmp/${1} > ${1}",
"fi"
]
}
],
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\" {{user `vagrantfile_template`}}",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ ! -d output-tmp ]]; then",
" mkdir output-tmp",
"fi",
"if [[ -n ${1} ]] && [[ -f ${1} ]]; then",
" echo '--> Generating Vagrantfile template.'",
" cp -pf ${1} output-tmp/${1}",
" sed -e 's~[{][{]user `ssh_user`[}][}]~{{user `ssh_user`}}~g' output-tmp/${1} > ${1}",
"fi"
]
},
{
"type": "vagrant",
"vagrantfile_template": "CentOS-7.Vagrantfile",
"vagrantfile_template": "{{user `vagrantfile_template`}}",
"output": "{{user `build_output_directory`}}/{{.BuildName}}-{{.Provider}}.box",
"compression_level": 9,
"keep_input_artifact": true
},
[
{
"type": "artifice",
"files": [
"output-tmp/CentOS-7.Vagrantfile"
]
},
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\"",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ -n ${1} ]] && [[ -f ${1} ]]; then",
" echo '--> Restoring Vagrantfile template.'",
" mv -f ${1} .",
"fi",
"echo '--> Cleanup output directories.'",
"find . -mindepth 1 -maxdepth 1 -type d -name \"output-*\" -exec rm -rf '{}' +"
]
}
]
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\" {{user `vagrantfile_template`}}",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ -n ${1} ]] && [[ -f ${1} ]]; then",
" echo '--> Restoring Vagrantfile template.'",
" mv -f ${1} .",
"fi",
"echo '--> Cleanup output directories.'",
"find . -mindepth 1 -maxdepth 1 -type d -name \"output-*\" -exec rm -rf '{}' +"
]
}
],
"provisioners": [
{
Expand Down
77 changes: 31 additions & 46 deletions CentOS-7-Minimal-virtualbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"ssh_user_home": "/home/vagrant",
"ssh_user_password": "vagrant",
"ssh_user_shell": "/bin/bash",
"ssh_user_sudo": "ALL=(ALL) NOPASSWD:ALL"
"ssh_user_sudo": "ALL=(ALL) NOPASSWD:ALL",
"vagrantfile_template": "CentOS-7.Vagrantfile"
},
"builders": [
{
Expand Down Expand Up @@ -114,57 +115,41 @@
"compression_level": 9,
"keep_input_artifact": true
},
[
{
"type": "artifice",
"files": [
"CentOS-7.Vagrantfile"
]
},
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\"",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ ! -d output-tmp ]]; then",
" mkdir output-tmp",
"fi",
"if [[ -n ${1} ]] && [[ -f ${1} ]]; then",
" echo '--> Generating Vagrantfile template.'",
" cp -pf ${1} output-tmp/${1}",
" sed -e 's~[{][{]user `ssh_user`[}][}]~{{user `ssh_user`}}~g' output-tmp/${1} > ${1}",
"fi"
]
}
],
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\" {{user `vagrantfile_template`}}",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ ! -d output-tmp ]]; then",
" mkdir output-tmp",
"fi",
"if [[ -n ${1} ]] && [[ -f ${1} ]]; then",
" echo '--> Generating Vagrantfile template.'",
" cp -pf ${1} output-tmp/${1}",
" sed -e 's~[{][{]user `ssh_user`[}][}]~{{user `ssh_user`}}~g' output-tmp/${1} > ${1}",
"fi"
]
},
{
"type": "vagrant",
"vagrantfile_template": "CentOS-7.Vagrantfile",
"vagrantfile_template": "{{user `vagrantfile_template`}}",
"output": "{{user `build_output_directory`}}/{{.BuildName}}-{{.Provider}}.box",
"compression_level": 9,
"keep_input_artifact": true
},
[
{
"type": "artifice",
"files": [
"output-tmp/CentOS-7.Vagrantfile"
]
},
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\"",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ -n ${1} ]] && [[ -f ${1} ]]; then",
" echo '--> Restoring Vagrantfile template.'",
" mv -f ${1} .",
"fi",
"echo '--> Cleanup output directories.'",
"find . -mindepth 1 -maxdepth 1 -type d -name \"output-*\" -exec rm -rf '{}' +"
]
}
]
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\" {{user `vagrantfile_template`}}",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ -n ${1} ]] && [[ -f ${1} ]]; then",
" echo '--> Restoring Vagrantfile template.'",
" mv -f ${1} .",
"fi",
"echo '--> Cleanup output directories.'",
"find . -mindepth 1 -maxdepth 1 -type d -name \"output-*\" -exec rm -rf '{}' +"
]
}
],
"provisioners": [
{
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ The build environment required is Mac OSX or GNU Linux.

To build the box file you will need the following installed:

- [VirtualBox](https://www.virtualbox.org) (5.0.30)
- [Vagrant](https://www.vagrantup.com) (1.9.1)
- [Packer](https://www.packer.io) (0.12.1)
- [VirtualBox](https://www.virtualbox.org) (5.1.22)
- [Vagrant](https://www.vagrantup.com) (1.9.5)
- [Packer](https://www.packer.io) (1.0.0)

### Build

Expand Down

0 comments on commit a7a4f03

Please sign in to comment.