VirtualBox

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

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

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1#!/bin/sh
2
3#
4# Copyright (C) 2006-2012 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 (GPL) as published by the Free Software
10# Foundation, in version 2 as it comes in the "COPYING" file of the
11# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
12# hope that it will 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# defaults
27[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
28
29if [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "failed-upgrade" ]; then
30 . /usr/share/debconf/confmodule
31 db_version 2.0
32 db_capb backup
33
34 # check for active VMs
35 VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null`
36 if [ -n "$VBOXSVC_PID" ]; then
37 # try graceful termination; terminate the balloon control servic first
38 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
39 invoke-rc.d vboxballoonctrl-service stop || true
40 else
41 /etc/init.d/vboxballoonctrl-service stop || true
42 fi
43 # try graceful termination; terminate the webservice first
44 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
45 invoke-rc.d vboxweb-service stop || true
46 else
47 /etc/init.d/vboxweb-service stop || true
48 fi
49 kill -USR1 $VBOXSVC_PID
50 sleep 1
51 if pidof VBoxSVC > /dev/null 2>&1; then
52 if [ "$1" != "failed-upgrade" ]; then
53 db_fset virtualbox/old-running seen false || true
54 db_input critical virtualbox/old-running || true
55 db_go || true
56 fi
57 exit 1
58 fi
59 fi
60fi
61
62# make sure we de-register the DMKS modules before the files get removed
63if [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "deconfigure" ]; then
64 DKMS=`which dkms 2>/dev/null`
65 if [ -n "$DKMS" ]; then
66 $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
67 fi
68fi
69
70# stop vboxnet/vboxdrv manually as we use our own error handling in postrm
71if [ -x "/etc/init.d/vboxdrv" ]; then
72 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
73 invoke-rc.d vboxdrv stop || exit $?
74 else
75 /etc/init.d/vboxdrv stop || exit $?
76 fi
77fi
78if [ -x "/etc/init.d/vboxnet" ]; then
79 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
80 invoke-rc.d vboxnet stop || exit $?
81 else
82 /etc/init.d/vboxnet stop || exit $?
83 fi
84fi
85
86#DEBHELPER#
87
88exit 0
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