VirtualBox

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

Last change on this file since 63378 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

File size: 3.3 KB
Line 
1#!/bin/bash
2#
3# Copyright (C) 2006-2012 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
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 VBOXSVC_PID=`pidof VBoxSVC 2> /dev/null || true`
30 if [ -n "$VBOXSVC_PID" ]; then
31 if [ -f /etc/init.d/vboxballoonctrl-service ]; then
32 # try graceful termination; terminate the ballon control service first
33 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
34 invoke-rc.d vboxballoonctrl-service stop || true
35 else
36 /etc/init.d/vboxballoonctrl-service stop || true
37 fi
38 fi
39 if [ -f /etc/init.d/vboxweb-service ]; then
40 # try graceful termination; terminate the webservice first
41 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
42 invoke-rc.d vboxweb-service stop || true
43 else
44 /etc/init.d/vboxweb-service stop || true
45 fi
46 fi
47 kill -USR1 $VBOXSVC_PID
48 sleep 1
49 if pidof VBoxSVC > /dev/null 2>&1; then
50 db_fset virtualbox/old-running seen false || true
51 db_input critical virtualbox/old-running || true
52 db_go || true
53 exit 1
54 fi
55 fi
56
57 # check for old installation
58 if [ -r /etc/vbox/vbox.cfg ]; then
59 . /etc/vbox/vbox.cfg
60 if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
61 db_fset virtualbox/old-installation-found seen false || true
62 db_input critical virtualbox/old-installation-found || true
63 db_go || true
64 exit 1
65 fi
66 # we will remove that file in postinst
67 fi
68
69 # check for old vboxdrv modules
70 if [ "$INSTALL_NO_VBOXDRV" != "1" ]; then
71 if find /lib/modules -name "vboxdrv\.*" 2>/dev/null|grep -q vboxdrv; then
72 # old modules found
73 db_get virtualbox/delete-old-modules || true
74 if [ "$RET" = "false" ]; then
75 cat << EOF
76Old vboxdrv kernel modules found in
77EOF
78 find /lib/modules -name "vboxdrv\.*" 2>/dev/null|sed "s+\(.*\)+ \1+g"
79 cat << EOF
80Removing of these modules denied by debconf setting
81EOF
82 else
83 db_input low virtualbox/delete-old-modules || true
84 db_go || true
85 db_get virtualbox/delete-old-modules || true
86 if [ "$RET" = "true" ]; then
87 find /lib/modules -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2>/dev/null
88 find /lib/modules -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2>/dev/null
89 find /lib/modules -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2>/dev/null
90 fi
91 fi
92 fi
93 fi
94
95fi # "$1" = "install" -o "$1" = "upgrade"
96
97#DEBHELPER#
98
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