VirtualBox

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

Last change on this file since 34646 was 32543, checked in by vboxsync, 14 years ago

Linux installer: sync deb

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