From 623380578bdc80ad31719c6174bc2df5d4f5b103 Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Fri, 20 Dec 2013 00:56:45 -0500 Subject: [PATCH] Allow building provisionered OmniOS boxes. Make chef.sh more reliable by not shelling so much... just chmod +x the downloaded script. --- packer/omnios-r151008f.json | 4 +++- packer/scripts/common/chef.sh | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packer/omnios-r151008f.json b/packer/omnios-r151008f.json index 5b372be9d..edcd5349b 100644 --- a/packer/omnios-r151008f.json +++ b/packer/omnios-r151008f.json @@ -8,9 +8,11 @@ "type": "shell", "scripts": [ "scripts/omnios/vmtools.sh", + "scripts/common/chef.sh", "scripts/omnios/postinstall.sh" ], - "execute_command": "{{.Vars}} sh '{{.Path}}'" + "execute_command": "export {{.Vars}} && sh '{{.Path}}'", + "environment_vars": [ "CHEF_VERSION={{user `chef_version`}}" ] } ], "post-processors": [ diff --git a/packer/scripts/common/chef.sh b/packer/scripts/common/chef.sh index a2682cc51..0c3f86bbf 100644 --- a/packer/scripts/common/chef.sh +++ b/packer/scripts/common/chef.sh @@ -185,14 +185,15 @@ do_download() { if [ x$CHEF_VERSION != x'provisionerless' ]; then do_download "$chef_installer_url" "$chef_installer" + chmod +x $chef_installer if [ x$CHEF_VERSION == x'latest' ]; then - sh "$chef_installer" + $chef_installer elif [ x$CHEF_VERSION == x'prerelease' ]; then - sh "$chef_installer" -p + $chef_installer -p else - sh "$chef_installer" -v $CHEF_VERSION + $chef_installer -v $CHEF_VERSION fi - rm -f "$chef_installer" + rm -f $chef_installer else echo "Building a box without Chef" fi