1 | # Oracle VM VirtualBox
|
---|
2 | # VirtualBox Linux pre-uninstaller common portions
|
---|
3 | #
|
---|
4 |
|
---|
5 | # Copyright (C) 2015 Oracle Corporation
|
---|
6 | #
|
---|
7 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
8 | # available from http://www.virtualbox.org. This file is free software;
|
---|
9 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
10 | # General Public License (GPL) as published by the Free Software
|
---|
11 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
12 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
13 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
14 | #
|
---|
15 |
|
---|
16 | # Put bits of the pre-uninstallation here which should work the same for all of
|
---|
17 | # the Linux installers. We do not use special helpers (e.g. dh_* on Debian),
|
---|
18 | # but that should not matter, as we know what those helpers actually do, and we
|
---|
19 | # have to work on those systems anyway when installed using the all
|
---|
20 | # distributions installer.
|
---|
21 | #
|
---|
22 | # We assume that all required files are in the same folder as this script
|
---|
23 | # (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
|
---|
24 | #
|
---|
25 | # Script exit status: 0 on success, 1 if VirtualBox is running and can not be
|
---|
26 | # stopped (installers may show an error themselves or just pass on standard
|
---|
27 | # error).
|
---|
28 |
|
---|
29 | # The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
|
---|
30 | TARGET=`readlink -e -- "${0}"` || exit 1
|
---|
31 | MY_PATH="${TARGET%/[!/]*}"
|
---|
32 | cd "${MY_PATH}"
|
---|
33 | . "./routines.sh"
|
---|
34 |
|
---|
35 | # Stop the ballon control service
|
---|
36 | stop_init_script vboxballoonctrl-service >/dev/null 2>&1
|
---|
37 | # Stop the autostart service
|
---|
38 | stop_init_script vboxautostart-service >/dev/null 2>&1
|
---|
39 | # Stop the web service
|
---|
40 | stop_init_script vboxweb-service >/dev/null 2>&1
|
---|
41 | # Do this check here after we terminated the web service: check whether VBoxSVC
|
---|
42 | # is running and exit if it can't be stopped.
|
---|
43 | check_running
|
---|
44 | # Terminate VBoxNetDHCP if running
|
---|
45 | terminate_proc VBoxNetDHCP
|
---|
46 | # Terminate VBoxNetNAT if running
|
---|
47 | terminate_proc VBoxNetNAT
|
---|
48 | delrunlevel vboxballoonctrl-service
|
---|
49 | remove_init_script vboxballoonctrl-service
|
---|
50 | delrunlevel vboxautostart-service
|
---|
51 | remove_init_script vboxautostart-service
|
---|
52 | delrunlevel vboxweb-service
|
---|
53 | remove_init_script vboxweb-service
|
---|
54 | # Stop kernel module and uninstall runlevel script
|
---|
55 | stop_init_script vboxdrv >/dev/null 2>&1
|
---|
56 | delrunlevel vboxdrv
|
---|
57 | remove_init_script vboxdrv
|
---|
58 | # And do final clean-up
|
---|
59 | "${MY_PATH}/vboxdrv.sh" cleanup >/dev/null # Do not silence errors for now
|
---|
60 | # Stop host networking and uninstall runlevel script (obsolete)
|
---|
61 | stop_init_script vboxnet >/dev/null 2>&1
|
---|
62 | delrunlevel vboxnet >/dev/null 2>&1
|
---|
63 | remove_init_script vboxnet >/dev/null 2>&1
|
---|
64 | rm -f /sbin/vboxconfig
|
---|
65 | exit 0
|
---|