desktop/virtualbox/virtualbox-ext-oracle.install
Chaoting Liu f6c947430a virtualbox-ext-oracle: edit the .install file
- oracle implement license agreement into terminal dialog, we have to
bypass it to automate the installation
2017-05-03 15:18:41 +01:00

48 lines
1.5 KiB
Bash

#!/bin/bash
DIR=/usr/share/virtualbox/extensions
TMP_DIR=/tmp/Oracle_VM_VirtualBox_Extension_Pack
virtualbox-ext-oracle-installer() {
[ -d $TMP_DIR ] && rm -rf $TMP_DIR
mkdir $TMP_DIR
cd $TMP_DIR
wget "https://www.virtualbox.org/download/hashes/$1/SHA256SUMS" -O SHA256SUMS
EXTPACK_FILE="Oracle_VM_VirtualBox_Extension_Pack-${1}.vbox-extpack"
if "$(sha256sum -c SHA256SUMS)" > /dev/null 2>&1
then
echo "nothing to do, you are already using the latest VirtualBox Extension provided by Oracle"
else
SRC_URL="http://download.virtualbox.org/virtualbox/${1}/${EXTPACK_FILE}"
wget "$SRC_URL" -O "${EXTPACK_FILE}"
cp -f "${EXTPACK_FILE}" $DIR/
fi
}
# arg 1: the new package version
post_install() {
virtualbox-ext-oracle-installer "${1%%-*}"
VBoxManage extpack install --accept-license="$(sha256sum /usr/share/licenses/virtualbox-ext-oracle/PUEL | head --bytes=64)" "/usr/share/virtualbox/extensions/Oracle_VM_VirtualBox_Extension_Pack-${1%%-*}.vbox-extpack" >/dev/null
}
# arg 1: the new package version
# arg 2: the old package version
pre_upgrade() {
pre_remove "$2"
}
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
post_install "$1"
}
# arg 1: the old package version
pre_remove() {
VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack" >/dev/null
rm -rf ${DIR}/Oracle_VM_VirtualBox_Extension_Pack-${1%%-*}.vbox-extpack >/dev/null
}
# vim:set ts=2 sw=2 ft=sh et: