Skip to content

Instantly share code, notes, and snippets.

@kirb
Created December 10, 2011 12:35
Show Gist options
  • Save kirb/1455064 to your computer and use it in GitHub Desktop.
Save kirb/1455064 to your computer and use it in GitHub Desktop.
Install VirtualBox Guest Additions on Ubuntu
#!/bin/bash
echo "VirtualBox Guest Additions Installer for Ubuntu"
echo ""
echo "Written by Ad@m <http://adamscode.sourceforge.net>"
echo "Licensed under the MIT License <http://adam.mit-license.org>"
echo ""
if [[ ! -f "/usr/bin/apt-get" ]]; then
echo "Please install apt-get from your packaging software and try this script again."
exit 1
fi
pushd /media/VBOXADDITIONS_*
if [[ $? != 0 ]]; then
echo "Please mount the guest additions disc from the media menu and try this script again."
exit 2
fi
echo "Installing required packages..."
sudo apt-get install -y -q dkms build-essential linux-headers-generic
echo "...done, now installing guest additions..."
sudo ./VBoxLinuxAdditions.run
echo "...finished, now rebooting machine..."
for i in {10,9,8,7,6,5,4,3,2,1}; do
echo "Rebooting in $i seconds..."
sleep 1
fi
sudo reboot
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment