1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # Copyright (C) 2006-2015 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 (GPL) as published by the Free Software
|
---|
9 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
10 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
11 | # hope that it will 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 |
|
---|
22 | if [ "$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 old installation
|
---|
29 | if [ -r /etc/vbox/vbox.cfg ]; then
|
---|
30 | . /etc/vbox/vbox.cfg
|
---|
31 | if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
|
---|
32 | db_fset virtualbox/old-installation-found seen false || true
|
---|
33 | db_input critical virtualbox/old-installation-found || true
|
---|
34 | db_go || true
|
---|
35 | exit 1
|
---|
36 | fi
|
---|
37 | # we will remove that file in postinst
|
---|
38 | fi
|
---|
39 |
|
---|
40 | # check for active VMs
|
---|
41 | # Execute the installed package's pre-uninstaller if present.
|
---|
42 | /usr/lib/virtualbox/prerm-common.sh 2>/dev/null || true
|
---|
43 | # Stop services from older versions without pre-uninstaller.
|
---|
44 | invoke-rc.d vboxballoonctrl-service stop 2>/dev/null || true
|
---|
45 | /etc/init.d/vboxballoonctrl-service stop 2>/dev/null || true
|
---|
46 | invoke-rc.d vboxautostart-service stop 2>/dev/null || true
|
---|
47 | /etc/init.d/vboxautostart-service stop 2>/dev/null || true
|
---|
48 | invoke-rc.d vboxweb-service stop 2>/dev/null || true
|
---|
49 | /etc/init.d/vboxweb-service stop 2>/dev/null || true
|
---|
50 | VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
|
---|
51 | if [ -n "$VBOXSVC_PID" ]; then
|
---|
52 | # ask the daemon to terminate immediately
|
---|
53 | kill -USR1 $VBOXSVC_PID
|
---|
54 | sleep 1
|
---|
55 | if pidof VBoxSVC > /dev/null 2>&1; then
|
---|
56 | db_fset virtualbox/old-running seen false || true
|
---|
57 | db_input critical virtualbox/old-running || true
|
---|
58 | db_go || true
|
---|
59 | exit 1
|
---|
60 | fi
|
---|
61 | fi
|
---|
62 |
|
---|
63 | fi # "$1" = "install" -o "$1" = "upgrade"
|
---|
64 |
|
---|
65 | #DEBHELPER#
|
---|
66 |
|
---|