39 lines
1.2 KiB
Bash
39 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#set -e
|
|
|
|
version="#VERSION#"
|
|
hash="e020755711849fa0ee23d3bc47bc90cb0ea595da7dda804499568a0dc2387989 "
|
|
file="Oracle_VirtualBox_Extension_Pack-${version}.vbox-extpack"
|
|
accept_license="eb31505e56e9b4d0fbca139104da41ac6f6b98f8e78968bdf01b1f3da3c4f9ae"
|
|
|
|
error ()
|
|
{
|
|
if [ "${1}" = "hash" ] ; then
|
|
echo "Hash mismatch ${file}: expected ${hash}, removing the file."
|
|
rm -f ${file}
|
|
elif [ "${1}" = "install" ]; then
|
|
echo "Installation error: License key incorrect or unknown problem during installation."
|
|
fi
|
|
exit 1
|
|
}
|
|
|
|
# Source debconf library.
|
|
. /usr/share/debconf/confmodule
|
|
|
|
if [ "${1}" = "configure" ] ; then
|
|
sharedir="/usr/share/virtualbox-ext-pack"
|
|
cachedir="/var/cache/virtualbox-ext-pack"
|
|
if [ -f ${sharedir}/${file} ]; then
|
|
echo "installing pre-downloaded file from ${sharedir}"
|
|
cd ${sharedir}
|
|
else
|
|
cd ${cachedir}
|
|
echo "virtualbox-ext-pack: downloading: https://download.virtualbox.org/virtualbox/${version}/${file}"
|
|
echo "The file will be downloaded into ${cachedir}"
|
|
/usr/bin/wget -q -N https://download.virtualbox.org/virtualbox/${version}/${file}
|
|
fi
|
|
echo "${hash} ${file}" | sha256sum -c > /dev/null 2>&1 || error hash
|
|
vboxmanage extpack install --replace --accept-license=${accept_license} ${file} || error install
|
|
fi
|
|
|
|
#DEBHELPER#
|