Skip to content

Instantly share code, notes, and snippets.

@fbender
Last active December 28, 2015 00:59
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 fbender/7417106 to your computer and use it in GitHub Desktop.
Save fbender/7417106 to your computer and use it in GitHub Desktop.
Oracle VirtualBox Extension Pack update helper (based on https://forums.virtualbox.org/viewtopic.php?f=7&t=44337#p199593).
#!/bin/bash
# license: MIT
# author: Florian Bender
# original script: Sasquatch (https://forums.virtualbox.org/viewtopic.php?f=7&t=44337#p199593)
# see comment below!
version=$(vboxmanage -v)
echo -n "Installed: $version; "
var1=$(echo $version | cut -d 'r' -f 1)
echo -n "Version $var1 "
var2=$(echo $version | cut -d 'r' -f 2)
echo "Build $var2 "
file="Oracle_VM_VirtualBox_Extension_Pack-$var1-$var2.vbox-extpack"
load=''
echo "--> Download '$file'? "
if [ -e /tmp/$file ]
then
echo "Already loaded:"
else
select load in "yes" "no"
do
if [ "$load" != "yes" ]
then
echo "Aborting."
exit 1;
fi
break;
done
echo "Loading ..."
wget http://download.virtualbox.org/virtualbox/$var1/$file -O /tmp/$file
echo "Result: $?"
fi
echo $(ls -hal /tmp/$file)
inst=''
echo "--> Install '$file' (may need uninstall for major version upgrade)?"
select inst in "replace" "uninstall+reinstall" "no"
do
if [ "$inst" == "replace" ]
then
echo "Replacing ..."
sudo VBoxManage extpack install /tmp/$file --replace
exit $?;
fi
if [ "$inst" == "uninstall+reinstall" ]
then
echo "Uninstalling ..."
## MAY be needed for major version upgrades, e.g. 4.0 -> 4.1! see https://forums.virtualbox.org/viewtopic.php?f=7&t=44337#p199593
sudo VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"
echo "Reinstalling ..."
sudo VBoxManage extpack install /tmp/$file
exit $?;
fi
break;
done
echo "Nothing to do here ..."
exit 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment