1 | #!/bin/sh
|
---|
2 | # $Id: prerm-common.sh 98103 2023-01-17 14:15:46Z vboxsync $
|
---|
3 | ## @file
|
---|
4 | # Oracle VM VirtualBox
|
---|
5 | # VirtualBox Linux pre-uninstaller common portions
|
---|
6 | #
|
---|
7 |
|
---|
8 | #
|
---|
9 | # Copyright (C) 2015-2023 Oracle and/or its affiliates.
|
---|
10 | #
|
---|
11 | # This file is part of VirtualBox base platform packages, as
|
---|
12 | # available from https://www.virtualbox.org.
|
---|
13 | #
|
---|
14 | # This program is free software; you can redistribute it and/or
|
---|
15 | # modify it under the terms of the GNU General Public License
|
---|
16 | # as published by the Free Software Foundation, in version 3 of the
|
---|
17 | # License.
|
---|
18 | #
|
---|
19 | # This program is distributed in the hope that it will be useful, but
|
---|
20 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | # General Public License for more details.
|
---|
23 | #
|
---|
24 | # You should have received a copy of the GNU General Public License
|
---|
25 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 | #
|
---|
27 | # SPDX-License-Identifier: GPL-3.0-only
|
---|
28 | #
|
---|
29 |
|
---|
30 | # Put bits of the pre-uninstallation here which should work the same for all of
|
---|
31 | # the Linux installers. We do not use special helpers (e.g. dh_* on Debian),
|
---|
32 | # but that should not matter, as we know what those helpers actually do, and we
|
---|
33 | # have to work on those systems anyway when installed using the all
|
---|
34 | # distributions installer.
|
---|
35 | #
|
---|
36 | # We assume that all required files are in the same folder as this script
|
---|
37 | # (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
|
---|
38 | #
|
---|
39 | # Script exit status: 0 on success, 1 if VirtualBox is running and can not be
|
---|
40 | # stopped (installers may show an error themselves or just pass on standard
|
---|
41 | # error).
|
---|
42 |
|
---|
43 |
|
---|
44 | # The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
|
---|
45 | TARGET=`readlink -e -- "${0}"` || exit 1
|
---|
46 | MY_PATH="${TARGET%/[!/]*}"
|
---|
47 | cd "${MY_PATH}"
|
---|
48 | . "./routines.sh"
|
---|
49 |
|
---|
50 | # Stop the ballon control service
|
---|
51 | stop_init_script vboxballoonctrl-service >/dev/null 2>&1
|
---|
52 | # Stop the autostart service
|
---|
53 | stop_init_script vboxautostart-service >/dev/null 2>&1
|
---|
54 | # Stop the web service
|
---|
55 | stop_init_script vboxweb-service >/dev/null 2>&1
|
---|
56 | # Do this check here after we terminated the web service: check whether VBoxSVC
|
---|
57 | # is running and exit if it can't be stopped.
|
---|
58 | check_running
|
---|
59 | # Terminate VBoxNetDHCP if running
|
---|
60 | terminate_proc VBoxNetDHCP
|
---|
61 | # Terminate VBoxNetNAT if running
|
---|
62 | terminate_proc VBoxNetNAT
|
---|
63 | delrunlevel vboxballoonctrl-service
|
---|
64 | remove_init_script vboxballoonctrl-service
|
---|
65 | delrunlevel vboxautostart-service
|
---|
66 | remove_init_script vboxautostart-service
|
---|
67 | delrunlevel vboxweb-service
|
---|
68 | remove_init_script vboxweb-service
|
---|
69 | # Stop kernel module and uninstall runlevel script
|
---|
70 | stop_init_script vboxdrv >/dev/null 2>&1
|
---|
71 | delrunlevel vboxdrv
|
---|
72 | remove_init_script vboxdrv
|
---|
73 | # And do final clean-up
|
---|
74 | "${MY_PATH}/vboxdrv.sh" cleanup >/dev/null # Do not silence errors for now
|
---|
75 | # Stop host networking and uninstall runlevel script (obsolete)
|
---|
76 | stop_init_script vboxnet >/dev/null 2>&1
|
---|
77 | delrunlevel vboxnet >/dev/null 2>&1
|
---|
78 | remove_init_script vboxnet >/dev/null 2>&1
|
---|
79 | finish_init_script_install
|
---|
80 | rm -f /sbin/vboxconfig
|
---|
81 | exit 0
|
---|