prerm.in revision f2ca52afeb0baed982c05e9d8591e0e4c7539dbd
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# Copyright (C) 2006-2010 Oracle Corporation
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# available from http://www.virtualbox.org. This file is free software;
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# you can redistribute it and/or modify it under the terms of the GNU
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# General Public License as published by the Free Software Foundation,
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# distribution. VirtualBox OSE is distributed in the hope that it will
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# be useful, but WITHOUT ANY WARRANTY of any kind.
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# we can be called with the following arguments (6.5 of Debian policy):
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# upgrade: (new version): upgrade to a new version
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# failed-upgrade: (our version): failed to upgrade
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# remove: (our version): remove this package
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# purge: (our version): purge this package
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# deconfigure: (our version): removing conflicting version
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# remove our USB device tree
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsyncif [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "failed-upgrade" ]; then
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync # check for active VMs
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync if [ -n "$VBOXSVC_PID" ]; then
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync # try graceful termination; terminate the balloon control servic first
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync # try graceful termination; terminate the webservice first
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# make sure we de-register the DMKS modules before the files get removed
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsyncif [ "$1" = "upgrade" -o "$1" = "remove" -o "$1" = "deconfigure" ]; then
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync if [ -n "$DKMS" ]; then
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync $DKMS remove -m vboxhost -v %VER% --all > /dev/null 2>&1 || true
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync# stop vboxnet/vboxdrv manually as we use our own error handling in postrm
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsyncif [ -x "/etc/init.d/vboxdrv" ]; then
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsyncif [ -x "/etc/init.d/vboxnet" ]; then