Skip to content

Commit

Permalink
[BENTO-98] Handle missing 'curl' with 'wget'. Fix output file naming …
Browse files Browse the repository at this point in the history
…on FreeBSD i386.
  • Loading branch information
Julian C. Dunn committed Nov 29, 2013
1 parent be1153c commit a4e4614
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packer/freebsd-9.1-i386.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
],
"post-processors": [
{
"output": "../builds/{{.Provider}}/opscode_freebsd-9.1_provisionerless.box",
"output": "../builds/{{.Provider}}/opscode_freebsd-9.1-i386_chef-{{user `chef_version`}}.box",
"type": "vagrant"
}
]
Expand Down
25 changes: 23 additions & 2 deletions packer/scripts/common/chef.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,34 @@
# 'x.y.z' -- build a box with version x.y.z of Chef
# 'latest' -- build a box with the latest version of Chef

exists() {
if command -v $1 &>/dev/null
then
return 0
else
return 1
fi
}

if [ x$CHEF_VERSION != x'provisionerless' ]; then
if [ x$CHEF_VERSION == x'latest' ]; then
echo "Installing latest Chef version"
curl -L https://www.opscode.com/chef/install.sh | sh
if exists wget; then
wget https://www.opscode.com/chef/install.sh -O - | sh
else
if exists curl; then
curl -L https://www.opscode.com/chef/install.sh | sh
fi
fi
else
echo "Installing Chef version $CHEF_VERSION"
curl -L https://www.opscode.com/chef/install.sh | sh -s -- -v $CHEF_VERSION
if exists wget; then
wget https://www.opscode.com/chef/install.sh -O - | sh -s -- -v $CHEF_VERSION
else
if exists curl; then
curl -L https://www.opscode.com/chef/install.sh | sh -s -- -v $CHEF_VERSION
fi
fi
fi
else
echo "Building a box without Chef"
Expand Down

0 comments on commit a4e4614

Please sign in to comment.