%PDF- %PDF-
| Direktori : /proc/self/root/var/lib/dpkg/info/ |
| Current File : //proc/self/root/var/lib/dpkg/info/virtualbox-7.0.preinst |
#!/bin/bash
# $Id: preinst 167352 2025-02-05 11:55:19Z vgalitsy $
## @file
# VirtualBox pre-install.
#
#
# Copyright (C) 2006-2023 Oracle and/or its affiliates.
#
# This file is part of VirtualBox base platform packages, as
# available from https://www.virtualbox.org.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, in version 3 of the
# License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses>.
#
# SPDX-License-Identifier: GPL-3.0-only
#
# we can be called with the following arguments (6.5 of Debian policy):
# install: (our version): install our version
# upgrade: (our version): upgrade to our version
# abort-upgrade: (old version): upgrade to a new version failed
# defaults
[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
if [ "$1" = "install" -o "$1" = "upgrade" ]; then
. /usr/share/debconf/confmodule
db_version 2.0
db_capb backup
# check for old installation
if [ -r /etc/vbox/vbox.cfg ]; then
. /etc/vbox/vbox.cfg
if [ "x$INSTALL_DIR" != "x" -a -d "$INSTALL_DIR" ]; then
db_fset virtualbox/old-installation-found seen false || true
db_input critical virtualbox/old-installation-found || true
db_go || true
exit 1
fi
# we will remove that file in postinst
fi
# check for active VMs
# Execute the installed package's pre-uninstaller if present.
/usr/lib/virtualbox/prerm-common.sh 2>/dev/null || true
# Stop services from older versions without pre-uninstaller.
invoke-rc.d vboxballoonctrl-service stop 2>/dev/null || true
/etc/init.d/vboxballoonctrl-service stop 2>/dev/null || true
invoke-rc.d vboxautostart-service stop 2>/dev/null || true
/etc/init.d/vboxautostart-service stop 2>/dev/null || true
invoke-rc.d vboxweb-service stop 2>/dev/null || true
/etc/init.d/vboxweb-service stop 2>/dev/null || true
VBOXSVC_PID=`pidof VBoxSVC 2>/dev/null || true`
if [ -n "$VBOXSVC_PID" ]; then
# Ask VBoxSVC to terminate gracefully if it is not
# busy with handling client requests.
kill -USR1 $VBOXSVC_PID
# Wait for VBoxSVC to terminate.
for attempt in 1 2 3 4 5 6 7 8 9 10; do
[ -n "$(pidof VBoxSVC 2> /dev/null)" ] && sleep 1
done
# Still running?
if pidof VBoxSVC > /dev/null 2>&1; then
db_fset virtualbox/old-running seen false || true
db_input critical virtualbox/old-running || true
db_go || true
exit 1
fi
fi
fi # "$1" = "install" -o "$1" = "upgrade"