Skip to content

Instantly share code, notes, and snippets.

@thomasmerz
Created July 19, 2023 08:51
Show Gist options
  • Save thomasmerz/1788a4efbc8cf25cce0556b6168e46da to your computer and use it in GitHub Desktop.
Save thomasmerz/1788a4efbc8cf25cce0556b6168e46da to your computer and use it in GitHub Desktop.
Update Extension Pack for VirtualBox automatically (grep -qE "$(date +\%Y-\%m-\%d).*virtualbox" /var/log/zypp/history)
#!/bin/bash
cd "$HOME/VirtualBox VMs/" || exit 1
# https://www.virtualbox.org/manual/ch08.html
VERSION=$(VBoxManage -v|cut -d '_' -f1|cut -d "r" -f1)
CURRENT=$(VBoxManage list extpacks|grep "Version:"|awk '{print $2}')
# MUST BE RUN AFTER 'get_vboxguestadditions.sh' !!!
[ "${VERSION}" == "${CURRENT}" ] && exit 1
EXTPACK=Oracle_VM_VirtualBox_Extension_Pack-${VERSION}.vbox-extpack
URL=http://download.virtualbox.org/virtualbox/${VERSION}/${EXTPACK}
wget "$URL" --no-clobber --quiet && {
sudo VBoxManage extpack install --replace "$EXTPACK" \
--accept-license=xyz &>/dev/null || \
VBoxManage list extpacks | mail -s "[Info] Fehler beim Update von $EXTPACK" thomas; }
#VBoxManage list extpacks
#rm Oracle_VM_VirtualBox_Extension_Pack-$VERSION.vbox-extpack
@thomasmerz
Copy link
Author

--accept-license needs a value that you will get by this:

VBoxManage will display the SHA-256 value when performing a manual installation. The hash can of course be calculated by looking inside the extension pack and using sha256sum or similar on the license file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment