Skip to content

Instantly share code, notes, and snippets.

@ajlanghorn
Created August 26, 2014 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajlanghorn/c0ebd1cb421962899f69 to your computer and use it in GitHub Desktop.
Save ajlanghorn/c0ebd1cb421962899f69 to your computer and use it in GitHub Desktop.
Updating VBoxGuestAdditions between minor versions is a pain. So here's a lovely shell script... yay!!!1! (Boo!)
#!/bin/bash
#
# Upgrade VirtualBox Guest Additions
#
# This script removes VirtualBox Guest Additions v4.2.6 from the mirror
# machines when brought up using Vagrant, and installs v4.3.6 instead. This
# makes the version of VirtualBox being used in this repository the same as
# is used in the off-site backup and main Puppet repositories.
set -ex
$VBGA_DIR="/opt/VBoxGuestAdditions-4.2.6"
$MNT_DIR="/mnt/vbga"
# First, let's uninstall VBoxGuestAdditions-4.2.6
sudo .$DIR/uninstall.sh
# Now, let's check we've actually uninstalled it all by checking to see if
# $DIR is empty. If it is, tidy up after ourselves and remove $DIR. If not,
# hard fail by echoing out.
if [ "$(ls -A $DIR)" ]; then
echo "Uh-oh! $DIR is not empty."
else
echo "Yay! $DIR is empty. Removing VirtualBox Guest Additions v4.2.6..."
sudo rm -rf $DIR/*
fi
# Download VBGA ISO, create mountpoint and mount
wget http://download.virtualbox.org/virtualbox/4.3.6/VBoxGuestAdditions_4.3.6.iso /home/vagrant/
sudo mkdir -p $MNT_DIR
sudo mount -o loop VBoxGuestAdditions_4.3.6.iso $MNT_DIR
# Run installer script
touch /var/log/vbga_install.log
sudo ./$MNT_DIR/VBoxLinuxAdditions.run > /var/log/vbga_install.log
# Remove install log
sudo rm -f /var/log/vbga_install.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment