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