summaryrefslogtreecommitdiffstats
path: root/debian/virtualbox-dkms.preinst
blob: 03ad90b704b799a349c0fb351fbd11b2d899a961 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

set -e

#DEBHELPER#

case "$1" in
  install|upgrade)
		# These are no longer used
		for mod in vboxdrv vboxnetflt vboxnetadp; do
			dkms status -m $mod | while read line; do
				if echo "$line" | grep -q added > /dev/null ||
					echo "$line" | grep -q built > /dev/null ||
					echo "$line" | grep -q installed > /dev/null;
				then
					version=`echo "$line" | sed "s/$mod,\([^,]*\)[,:].*/\1/;t;d"`
					echo "Removing obsolete module $mod version $version"
					dkms remove -m $mod -v $version --all
				fi
			done
		done
  ;;
esac