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>
"provisioners": [
{
"type": "shell",
- "script": "config_vagrant.sh"
+ "scripts":
+ [
+ "config_vagrant.sh",
+ "config_virtualbox.sh"
+ ]
}
],
"post-processors": [
--- /dev/null
+#!/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