Install VBox Additions, fixes Vagrant sync'd dirs 46/22146/2
authorDaniel Farrell <dfarrell@redhat.com>
Tue, 9 Jun 2015 03:02:02 +0000 (23:02 -0400)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 9 Jun 2015 10:41:01 +0000 (10:41 +0000)
Have Packer's shell provisioner call a script that
installs the packages required by VirtualBox Guest
Additions, install VBox GA, clean up to save space.

Packer now builds a totally functional Vagrant base
box based on the latest CentOS (7.1, or 1503). Need
to use the Ansible role to install OpenDaylight.

Change-Id: Idbbf105522e2f6c34d3bcb30aba2b46258ffa917
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
packaging/packer/centos.json
packaging/packer/config_virtualbox.sh [new file with mode: 0644]

index 56cac9a4dc66dedef581ffd0e9712e2a8019fdf9..b98c26a0deb1335246588f5a6f2a31f155004e88 100644 (file)
   "provisioners": [
     {
       "type": "shell",
-      "script": "config_vagrant.sh"
+      "scripts":
+        [
+          "config_vagrant.sh",
+          "config_virtualbox.sh"
+        ]
     }
   ],
   "post-processors": [
diff --git a/packaging/packer/config_virtualbox.sh b/packaging/packer/config_virtualbox.sh
new file mode 100644 (file)
index 0000000..23a666f
--- /dev/null
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# Called by packer to install VirtualBox Guess Additions, which
+# required by Vagrant for things like mounting shared dirs.
+
+# Echo commands as they are run
+set -x
+
+# Install utilities required by VB Guest Additions install
+sudo yum install -y bzip2 gcc kernel-devel
+
+# Install VirtualBox Guest Additions (downloaded by Packer)
+sudo mount -o loop /home/vagrant/VBoxGuestAdditions.iso /mnt
+sudo /mnt/VBoxLinuxAdditions.run
+
+# Clean up VirtualBox Guest Additions install media to save space
+sudo umount /mnt
+rm -rf /home/vagrant/VBoxGuestAdditions.iso