VirtualBox

source: vbox/trunk/debian/prerm.in@ 35740

Last change on this file since 35740 was 34603, checked in by vboxsync, 14 years ago

Linux deb/rpm: more fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1#!/bin/sh
2
3#
4# Copyright (C) 2006-2010 Oracle Corporation
5#
6# This file is part of VirtualBox Open Source Edition (OSE), as
7# available from http://www.virtualbox.org. This file is free software;
8# you can redistribute it and/or modify it under the terms of the GNU
9# General Public License as published by the Free Software Foundation,
10# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
11# distribution. VirtualBox OSE is distributed in the hope that it will
12# be useful, but WITHOUT ANY WARRANTY of any kind.
13#
14
15# we can be called with the following arguments (6.5 of Debian policy):
16# upgrade: (new version): upgrade to a new version
17# failed-upgrade: (our version): failed to upgrade
18# remove: (our version): remove this package
19# purge: (our version): purge this package
20# deconfigure: (our version): removing conflicting version
21
22rm -f /etc/udev/rules.d/10-vboxdrv.rules
23rm -f /etc/vbox/license_agreed
24rm -f /etc/vbox/module_not_compiled
25
26# remove our USB device tree
27rm -rf /dev/vboxusb 2> /dev/null
28
29# defaults
30[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
31
32if [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "failed-upgrade" ]; then
33 . /usr/share/debconf/confmodule
34 db_version 2.0
35 db_capb backup
36
37 # check for active VMs
38 VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null`
39 if [ -n "$VBOXSVC_PID" ]; 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 kill -USR1 $VBOXSVC_PID
47 sleep 1
48 if pidof VBoxSVC > /dev/null 2>&1; then
49 if [ "$1" != "failed-upgrade" ]; then
50 db_fset virtualbox/old-running seen false || true
51 db_input critical virtualbox/old-running || true
52 db_go || true
53 fi
54 exit 1
55 fi
56 fi
57fi
58
59# make sure we de-register the DMKS modules before the files get removed
60if [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "deconfigure" ]; then
61 DKMS=`which dkms 2>/dev/null`
62 if [ -n "$DKMS" ]; then
63 $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
64 fi
65fi
66
67# stop vboxnet/vboxdrv manually as we use our own error handling in postrm
68if [ -x "/etc/init.d/vboxdrv" ]; then
69 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
70 invoke-rc.d vboxdrv stop || exit $?
71 else
72 /etc/init.d/vboxdrv stop || exit $?
73 fi
74fi
75if [ -x "/etc/init.d/vboxnet" ]; then
76 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
77 invoke-rc.d vboxnet stop || exit $?
78 else
79 /etc/init.d/vboxnet stop || exit $?
80 fi
81fi
82
83#DEBHELPER#
84
85exit 0
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use