Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Updating VBoxGuestAdditions between minor versions is a pain. So here's a lovely shell script... yay!!!1! (Boo!)
# 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
# First, let's uninstall VBoxGuestAdditions-4.2.6
sudo .$DIR/
# 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."
echo "Yay! $DIR is empty. Removing VirtualBox Guest Additions v4.2.6..."
sudo rm -rf $DIR/*
# Download VBGA ISO, create mountpoint and mount
wget /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/ > /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