VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/debian/preinst.in@ 32251

Last change on this file since 32251 was 32251, checked in by vboxsync, 15 years ago

Linux installer: vboxweb-service fixes

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

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