
* Use Ubuntu 14.04.3 ISO instead ovf box * Add a libvirt target as well * Add additional build shell scripts from bogdando/packer-atlas-example * Use sudo for all shell commands * Fix virtualbox guest additions build order * Cleanups to reduce end image size * Update README how to build and up both for vbox/libvirt Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
53 lines
1.6 KiB
Bash
53 lines
1.6 KiB
Bash
#!/bin/bash -eux
|
|
|
|
if [[ $PACKER_BUILDER_TYPE =~ vmware ]]; then
|
|
echo "==> Installing VMware Tools"
|
|
# Assuming the following packages are installed
|
|
# apt-get install -y linux-headers-$(uname -r) build-essential perl
|
|
|
|
cd /tmp
|
|
mkdir -p /mnt/cdrom
|
|
mount -o loop /home/vagrant/linux.iso /mnt/cdrom
|
|
tar zxf /mnt/cdrom/VMwareTools-*.tar.gz -C /tmp/
|
|
|
|
/tmp/vmware-tools-distrib/vmware-install.pl -d
|
|
|
|
rm /home/vagrant/linux.iso
|
|
umount /mnt/cdrom
|
|
rmdir /mnt/cdrom
|
|
rm -rf /tmp/VMwareTools-*
|
|
fi
|
|
|
|
if [[ $PACKER_BUILDER_TYPE =~ virtualbox ]]; then
|
|
echo "==> Installing VirtualBox guest additions"
|
|
# Assuming the following packages are installed
|
|
# apt-get install -y linux-headers-$(uname -r) build-essential perl
|
|
# apt-get install -y dkms
|
|
|
|
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
|
|
mount -o loop /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
|
|
sh /mnt/VBoxLinuxAdditions.run
|
|
umount /mnt
|
|
rm /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso
|
|
rm /home/vagrant/.vbox_version
|
|
|
|
if [[ $VBOX_VERSION = "4.3.10" ]]; then
|
|
ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
|
|
fi
|
|
/etc/init.d/vboxadd setup
|
|
fi
|
|
|
|
if [[ $PACKER_BUILDER_TYPE =~ parallels ]]; then
|
|
echo "==> Installing Parallels tools"
|
|
|
|
mount -o loop /home/vagrant/prl-tools-lin.iso /mnt
|
|
/mnt/install --install-unattended-with-deps
|
|
umount /mnt
|
|
rm -rf /home/vagrant/prl-tools-lin.iso
|
|
rm -f /home/vagrant/.prlctl_version
|
|
fi
|
|
|
|
if [[ $PACKER_BUILDER_TYPE =~ libvirt ]]; then
|
|
echo "==> Doing nothing special"
|
|
fi
|