1 | #!/bin/bash
|
---|
2 | # $Id: preinst 69498 2017-10-28 15:07:25Z vboxsync $
|
---|
3 | ## @file
|
---|
4 | # VirtualBox pre-install.
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2006-2015 Oracle Corporation
|
---|
9 | #
|
---|
10 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | # available from http://www.virtualbox.org. This file is free software;
|
---|
12 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | # General Public License (GPL) as published by the Free Software
|
---|
14 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | #
|
---|
18 |
|
---|
19 | # we can be called with the following arguments (6.5 of Debian policy):
|
---|
20 | # install: (our version): install our version
|
---|
21 | # upgrade: (our version): upgrade to our version
|
---|
22 | # abort-upgrade: (old version): upgrade to a new version failed
|
---|
23 |
|
---|
24 | # defaults
|
---|
25 | [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
|
---|
26 |
|
---|
27 | if [ "$1" = "install" -o "$1" = "upgrade" ]; then
|
---|
28 |
|
---|
29 | . /usr/share/debconf/confmodule
|
---|
30 | db_version 2.0
|
---|
31 | db_capb backup
|
---|
32 |
|
---|
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 critical virtualbox/old-installation-found || true
|
---|
39 | db_go || true
|
---|
40 | exit 1
|
---|
41 | fi
|
---|
42 | # we will remove that file in postinst
|
---|
43 | fi
|
---|
44 |
|
---|
45 | # check for active VMs
|
---|
46 | # Execute the installed package's pre-uninstaller if present.
|
---|
47 | /usr/lib/virtualbox/prerm-common.sh 2>/dev/null || true
|
---|
48 | # Stop services from older versions without pre-uninstaller.
|
---|
49 | invoke-rc.d vboxballoonctrl-service stop 2>/dev/null || true
|
---|
50 | /etc/init.d/vboxballoonctrl-service stop 2>/dev/null || true
|
---|
51 | invoke-rc.d vboxautostart-service stop 2>/dev/null || true
|
---|
52 | /etc/init.d/vboxautostart-service stop 2>/dev/null || true
|
---|
53 | invoke-rc.d vboxweb-service stop 2>/dev/null || true
|
---|
54 | /etc/init.d/vboxweb-service stop 2>/dev/null || true
|
---|
55 | VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
|
---|
56 | if [ -n "$VBOXSVC_PID" ]; then
|
---|
57 | # ask the daemon to terminate immediately
|
---|
58 | kill -USR1 $VBOXSVC_PID
|
---|
59 | sleep 1
|
---|
60 | if pidof VBoxSVC > /dev/null 2>&1; then
|
---|
61 | db_fset virtualbox/old-running seen false || true
|
---|
62 | db_input critical virtualbox/old-running || true
|
---|
63 | db_go || true
|
---|
64 | exit 1
|
---|
65 | fi
|
---|
66 | fi
|
---|
67 |
|
---|
68 | fi # "$1" = "install" -o "$1" = "upgrade"
|
---|
69 |
|
---|
70 | #DEBHELPER#
|
---|
71 |
|
---|