Allow compilation also with git-svn-mirrored repository
[virtualbox/dscho.git] / debian / preinst.in
blob411046e8956691b363f92db80a29c54e599fd12c
1 #!/bin/bash -e
3 # Copyright (C) 2006-2008 Sun Microsystems, Inc.
5 # This file is part of VirtualBox Open Source Edition (OSE), as
6 # available from http://www.virtualbox.org. This file is free software;
7 # you can redistribute it and/or modify it under the terms of the GNU
8 # General Public License as published by the Free Software Foundation,
9 # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
10 # distribution. VirtualBox OSE is distributed in the hope that it will
11 # be useful, but WITHOUT ANY WARRANTY of any kind.
14 # we can be called with the following arguments:
15 # install: (our version): install our version
16 # upgrade: (our version): upgrade to our version
17 # abort-upgrade: (old version): upgrade to a new version failed
19 if [ "$1" = "install" -o "$1" = "upgrade" ]; then
21 . /usr/share/debconf/confmodule
22 db_version 2.0
23 db_capb backup
25 # check for active VMs
26 if pidof VBoxSVC > /dev/null 2>&1; then
27 db_fset virtualbox/old-running seen false || true
28 db_input high virtualbox/old-running || true
29 db_go || true
30 exit 1
33 # check for old installation
34 if [ -r /etc/vbox/vbox.cfg ]; then
35 . /etc/vbox/vbox.cfg
36 if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
37 db_fset virtualbox/old-installation-found seen false || true
38 db_input high virtualbox/old-installation-found || true
39 db_go || true
40 exit 1
42 # we will remove that file in postinst
45 # check for old vboxdrv modules
46 if find /lib/modules -name "vboxdrv\.*" 2>/dev/null|grep -q vboxdrv; then
47 # old modules found
48 db_get virtualbox/delete-old-modules || true
49 if [ "$RET" = "false" ]; then
50 cat << EOF
51 Old vboxdrv kernel modules found in
52 EOF
53 find /lib/modules -name "vboxdrv\.*" 2>/dev/null|sed "s+\(.*\)+ \1+g"
54 cat << EOF
55 Removing of these modules denied by debconf setting
56 EOF
57 else
58 db_input critical virtualbox/delete-old-modules || true
59 db_go || true
60 db_get virtualbox/delete-old-modules || true
61 if [ "$RET" = "true" ]; then
62 find /lib/modules -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2>/dev/null
63 find /lib/modules -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2>/dev/null
64 find /lib/modules -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2>/dev/null
69 fi # "$1" = "install" -o "$1" = "upgrade"
71 #DEBHELPER#