summaryrefslogtreecommitdiffstats
path: root/debian/postinst.in
blob: 1ed888b3556e4dad0ced16fd7e23d0ae1eafd11f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
set -e

version=#VERSION#
hash=8887d5dd9dd26bd376926b38857715e28f2d678b6d3a034144ddc3fde4a387d9
file=Oracle_VM_VirtualBox_Extension_Pack-$version.vbox-extpack
accept_license=56be48f923303c8cababb0bb4c478284b688ed23f16d775d729b89a2e8e5f9eb

error ()
{
	echo "Hash mismatch $file: expected $hash, or wrong accept-license key, removing the file."
	rm -f /usr/share/virtualbox-ext-pack/$file
	exit 1
}

# Source debconf library.
. /usr/share/debconf/confmodule

if [ "$1" = "configure" ] ; then
	echo "removing old virtualbox extension packs"
	rm -f /usr/share/virtualbox-ext-pack/Oracle_VM_VirtualBox_Extension_Pack-*.vbox-extpack
	cd /usr/share/virtualbox-ext-pack
	echo "virtualbox-ext-pack: downloading: https://download.virtualbox.org/virtualbox/$version/$file"
	echo "The file will be downloaded into /usr/share/virtualbox-ext-pack"
	/usr/bin/wget -q -N http://download.virtualbox.org/virtualbox/$version/$file
	echo "$hash  $file" | sha256sum -c > /dev/null 2>&1 || error
	vboxmanage extpack install --replace --accept-license=$accept_license $file || error
	#rm -f /usr/share/virtualbox-ext-pack/$file
fi

#DEBHELPER#