Created
April 2, 2014 21:01
-
-
Save stevepereira/9943105 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "+------------------------------+" | |
echo "| Running VMTools Install |" | |
echo "+------------------------------+" | |
#!/usr/bin/env bash | |
mkdir /mnt/cdrom | |
# Check which Packer builder type is being used | |
if [ $PACKER_BUILDER_TYPE = "virtualbox-iso" ]; then | |
# Required for the VirtualBox Guest Additions for Linux | |
# http://www.virtualbox.org/manual/ch04.html | |
yum groupinstall -y 'Development tools' | |
yum groupinstall -y 'X Window system' | |
yum install -y bzip2 dkms gcc kernel-devel-`uname -r` make | |
# Required to prevent VBoxLinuxAdditions.run from throwing (harmless) errors | |
yum install -y which | |
export KERN_DIR=/usr/src/kernels/`uname -r` | |
# Install the VirtualBox Guest Additions | |
mount -t iso9660 -o loop /tmp/VBoxGuestAdditions.iso /mnt/cdrom | |
sh /mnt/cdrom/VBoxLinuxAdditions.run | |
# Cleanup | |
umount /mnt/cdrom | |
rm --force /tmp/VBoxGuestAdditions.iso | |
# # Fix permissions and SELinux context for Packer’s virtualbox_version_file | |
# chmod 0644 /etc/virtualbox-version | |
# chcon system_u:object_r:etc_t:s0 /etc/virtualbox-version | |
chkconfig |grep vbox > /root/vmtools_installed | |
fi | |
rmdir /mnt/cdrom | |
echo "+------------------------------+" | |
echo "| Finished VMTools Install |" | |
echo "+------------------------------+" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment