VirtualBox

source: vbox/trunk/debian/preinst.in@ 32287

Last change on this file since 32287 was 31999, checked in by vboxsync, 14 years ago

deb: sync

File size: 2.5 KB
Line 
1#!/bin/bash -e
2#
3# Copyright (C) 2006-2010 Oracle Corporation
4#
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.
12#
13
14# we can be called with the following arguments (6.5 of Debian policy):
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
18
19# defaults
20[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
21
22if [ "$1" = "install" -o "$1" = "upgrade" ]; then
23
24 . /usr/share/debconf/confmodule
25 db_version 2.0
26 db_capb backup
27
28 # check for active VMs
29 if pidof VBoxSVC > /dev/null 2>&1; then
30 db_fset virtualbox/old-running seen false || true
31 db_input critical virtualbox/old-running || true
32 db_go || true
33 exit 1
34 fi
35
36 # check for old installation
37 if [ -r /etc/vbox/vbox.cfg ]; then
38 . /etc/vbox/vbox.cfg
39 if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
40 db_fset virtualbox/old-installation-found seen false || true
41 db_input critical virtualbox/old-installation-found || true
42 db_go || true
43 exit 1
44 fi
45 # we will remove that file in postinst
46 fi
47
48 # check for old vboxdrv modules
49 if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
50 if find /lib/modules -name "vboxdrv\.*" 2>/dev/null|grep -q vboxdrv; then
51 # old modules found
52 db_get virtualbox/delete-old-modules || true
53 if [ "$RET" = "false" ]; then
54 cat << EOF
55Old vboxdrv kernel modules found in
56EOF
57 find /lib/modules -name "vboxdrv\.*" 2>/dev/null|sed "s+\(.*\)+ \1+g"
58 cat << EOF
59Removing of these modules denied by debconf setting
60EOF
61 else
62 db_input low virtualbox/delete-old-modules || true
63 db_go || true
64 db_get virtualbox/delete-old-modules || true
65 if [ "$RET" = "true" ]; then
66 find /lib/modules -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2>/dev/null
67 find /lib/modules -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2>/dev/null
68 find /lib/modules -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2>/dev/null
69 fi
70 fi
71 fi
72 fi
73
74fi # "$1" = "install" -o "$1" = "upgrade"
75
76#DEBHELPER#
77
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette