misheska / basebox-packer

Packer templates for vagrant baseboxes
286 stars 80 forks source link

Compiles correctly from ISO for VirtualBox now. #29

Closed jrgifford closed 10 years ago

jrgifford commented 10 years ago

Using the latest packer (v0.5.0), until this change was made, you could not build any of the machines using VirtualBox by default.

narkisr commented 10 years ago

The vmtools.sh needs to be fixed too

diff --git a/template/ubuntu/script/vmtools.sh b/template/ubuntu/script/vmtools.sh
index 8162cd9..de388f4 100644
--- a/template/ubuntu/script/vmtools.sh
+++ b/template/ubuntu/script/vmtools.sh
@@ -233,7 +233,7 @@ if [ $PACKER_BUILDER_TYPE == 'vmware' ]; then

     #apt-get -y remove linux-headers-$(uname -r) build-essential perl
     #apt-get -y autoremove
-elif [ $PACKER_BUILDER_TYPE == 'virtualbox' ]; then
+elif [ $PACKER_BUILDER_TYPE == 'virtualbox-iso' ]; then
     echo "Installing VirtualBox guest additions"

     apt-get install -y linux-headers-$(uname -r) build-essential per
misheska commented 10 years ago

Should work now. Ross Smith II came up with a best approach (so far) using a regex matcher:

if [[ $PACKER_BUILDER_TYPE =~ vmware ]]; then I've standardize on using [[ per

http://google-styleguide.googlecode.com/svn/trunk/shell.xml#Test,_%5B_and_%5B%5B