VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/prerm-common.sh@ 67772

Last change on this file since 67772 was 62678, checked in by vboxsync, 8 years ago

bugref:8525: Installers/Linux: reduce duplication between different installers: make removing kernel module files in the host installers more similar to the guest installer script.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1#!/bin/sh
2# $Id: prerm-common.sh 62678 2016-07-29 12:41:52Z vboxsync $
3## @file
4# Oracle VM VirtualBox
5# VirtualBox Linux pre-uninstaller common portions
6#
7
8# Copyright (C) 2015 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18
19# Put bits of the pre-uninstallation here which should work the same for all of
20# the Linux installers. We do not use special helpers (e.g. dh_* on Debian),
21# but that should not matter, as we know what those helpers actually do, and we
22# have to work on those systems anyway when installed using the all
23# distributions installer.
24#
25# We assume that all required files are in the same folder as this script
26# (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
27#
28# Script exit status: 0 on success, 1 if VirtualBox is running and can not be
29# stopped (installers may show an error themselves or just pass on standard
30# error).
31
32OLDMODULES="vboxdrv vboxnetflt vboxnetadp vboxpci"
33
34# The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
35TARGET=`readlink -e -- "${0}"` || exit 1
36MY_PATH="${TARGET%/[!/]*}"
37cd "${MY_PATH}"
38. "./routines.sh"
39
40# Stop the ballon control service
41stop_init_script vboxballoonctrl-service >/dev/null 2>&1
42# Stop the autostart service
43stop_init_script vboxautostart-service >/dev/null 2>&1
44# Stop the web service
45stop_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.
48check_running
49# Terminate VBoxNetDHCP if running
50terminate_proc VBoxNetDHCP
51# Terminate VBoxNetNAT if running
52terminate_proc VBoxNetNAT
53delrunlevel vboxballoonctrl-service
54remove_init_script vboxballoonctrl-service
55delrunlevel vboxautostart-service
56remove_init_script vboxautostart-service
57delrunlevel vboxweb-service
58remove_init_script vboxweb-service
59# Stop kernel module and uninstall runlevel script
60stop_init_script vboxdrv >/dev/null 2>&1
61delrunlevel vboxdrv
62remove_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)
66stop_init_script vboxnet >/dev/null 2>&1
67delrunlevel vboxnet >/dev/null 2>&1
68remove_init_script vboxnet >/dev/null 2>&1
69rm -f /sbin/vboxconfig
70# Remove any generated modules
71if [ -z "$VBOX_DONT_REMOVE_OLD_MODULES" ]; then
72 for i in ${OLDMODULES}; do
73 # Remove old modules.
74 rm -f /lib/modules/*/misc/"${i}"*
75 # This second is no longer used. Remove the line some time.
76 rm -f /lib/modules/*/kernel/misc/"${i}"*
77 done
78 # Remove leftover module folders.
79 for i in /lib/modules/*/misc; do
80 test -d "${i}" && rmdir -p "${i}" 2>/dev/null
81 done
82fi
83exit 0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette