VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/uninstall.sh@ 106061

Last change on this file since 106061 was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
File size: 5.1 KB
Line 
1#!/bin/sh
2#
3# Oracle VirtualBox
4# VirtualBox linux uninstallation script
5
6#
7# Copyright (C) 2009-2024 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
27
28# The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
29TARGET=`readlink -e -- "${0}"` || exit 1
30MY_PATH="${TARGET%/[!/]*}"
31. "${MY_PATH}/routines.sh"
32
33if [ -z "$ro_LOG_FILE" ]; then
34 create_log "/var/log/vbox-uninstall.log"
35fi
36
37if [ -z "VBOX_NO_UNINSTALL_MESSAGE" ]; then
38 info "Uninstalling VirtualBox"
39 log "Uninstalling VirtualBox"
40 log ""
41fi
42
43check_root
44
45[ -z "$CONFIG_DIR" ] && CONFIG_DIR="/etc/vbox"
46[ -z "$CONFIG" ] && CONFIG="vbox.cfg"
47[ -z "$CONFIG_FILES" ] && CONFIG_FILES="filelist"
48[ -z "$DEFAULT_FILES" ] && DEFAULT_FILES=`pwd`/deffiles
49
50# Find previous installation
51if [ -r "$CONFIG_DIR/$CONFIG" ]; then
52 . "$CONFIG_DIR/$CONFIG"
53 PREV_INSTALLATION="$INSTALL_DIR"
54fi
55
56# Remove previous installation
57if [ "$PREV_INSTALLATION" = "" ]; then
58 log "Unable to find a VirtualBox installation, giving up."
59 abort "Couldn't find a VirtualBox installation to uninstall."
60fi
61
62# Do pre-removal common to all installer types, currently service script
63# clean-up.
64"${MY_PATH}/prerm-common.sh" || exit 1
65
66# Remove kernel module installed
67if [ -z "$VBOX_DONT_REMOVE_OLD_MODULES" ]; then
68 rm -f "/usr/src/vboxhost-$INSTALL_VER" 2> /dev/null
69 rm -f "/usr/src/vboxdrv-$INSTALL_VER" 2> /dev/null
70 rm -f "/usr/src/vboxnetflt-$INSTALL_VER" 2> /dev/null
71 rm -f "/usr/src/vboxnetadp-$INSTALL_VER" 2> /dev/null
72 rm -f "/usr/src/vboxpci-$INSTALL_VER" 2> /dev/null
73fi
74
75# Remove symlinks
76rm -f \
77 /usr/bin/VirtualBox \
78 /usr/bin/VirtualBoxVM \
79 /usr/bin/VBoxManage \
80 /usr/bin/VBoxSDL \
81 /usr/bin/VBoxVRDP \
82 /usr/bin/VBoxHeadless \
83 /usr/bin/VBoxDTrace \
84 /usr/bin/VBoxAudioTest \
85 /usr/bin/VBoxBugReport \
86 /usr/bin/VBoxBalloonCtrl \
87 /usr/bin/VBoxAutostart \
88 /usr/bin/VBoxNetDHCP \
89 /usr/bin/VBoxNetNAT \
90 /usr/bin/vboxwebsrv \
91 /usr/bin/vbox-img \
92 /usr/bin/vboximg-mount \
93 /usr/bin/VBoxAddIF \
94 /usr/bin/VBoxDeleteIf \
95 /usr/bin/VBoxTunctl \
96 /usr/bin/virtualbox \
97 /usr/bin/virtualboxvm \
98 /usr/share/pixmaps/VBox.png \
99 /usr/share/pixmaps/virtualbox.png \
100 /usr/share/applications/virtualbox.desktop \
101 /usr/share/applications/virtualboxvm.desktop \
102 /usr/share/mime/packages/virtualbox.xml \
103 /usr/bin/rdesktop-vrdp \
104 /usr/bin/virtualbox \
105 /usr/bin/vboxmanage \
106 /usr/bin/vboxsdl \
107 /usr/bin/vboxheadless \
108 /usr/bin/vboxdtrace \
109 /usr/bin/vboxaudiotest \
110 /usr/bin/vboxbugreport \
111 "$PREV_INSTALLATION/components/VBoxVMM.so" \
112 "$PREV_INSTALLATION/components/VBoxREM.so" \
113 "$PREV_INSTALLATION/components/VBoxRT.so" \
114 "$PREV_INSTALLATION/components/VBoxDDU.so" \
115 "$PREV_INSTALLATION/components/VBoxXPCOM.so" \
116 "$PREV_INSTALLATION/VBoxREM.so" \
117 "$PREV_INSTALLATION/VBoxVRDP" \
118 "$PREV_INSTALLATION/VBoxVRDP.so" \
119 2> /dev/null
120
121cwd=`pwd`
122if [ -f "$PREV_INSTALLATION/src/Makefile" ]; then
123 cd "$PREV_INSTALLATION/src"
124 make clean > /dev/null 2>&1
125fi
126if [ -f "$PREV_INSTALLATION/src/vboxdrv/Makefile" ]; then
127 cd "$PREV_INSTALLATION/src/vboxdrv"
128 make clean > /dev/null 2>&1
129fi
130if [ -f "$PREV_INSTALLATION/src/vboxnetflt/Makefile" ]; then
131 cd "$PREV_INSTALLATION/src/vboxnetflt"
132 make clean > /dev/null 2>&1
133fi
134if [ -f "$PREV_INSTALLATION/src/vboxnetadp/Makefile" ]; then
135 cd "$PREV_INSTALLATION/src/vboxnetadp"
136 make clean > /dev/null 2>&1
137fi
138if [ -f "$PREV_INSTALLATION/src/vboxpci/Makefile" ]; then
139 cd "$PREV_INSTALLATION/src/vboxpci"
140 make clean > /dev/null 2>&1
141fi
142cd "$PREV_INSTALLATION"
143if [ -r "$CONFIG_DIR/$CONFIG_FILES" ]; then
144 rm -f `cat "$CONFIG_DIR/$CONFIG_FILES"` 2> /dev/null
145elif [ -n "$DEFAULT_FILES" -a -r "$DEFAULT_FILES" ]; then
146 DEFAULT_FILE_NAMES=""
147 . "$DEFAULT_FILES"
148 rm -f $DEFAULT_FILE_NAMES 2> /dev/null
149fi
150for file in `find "$PREV_INSTALLATION" 2> /dev/null`; do
151 rmdir -p "$file" 2> /dev/null
152done
153cd "$cwd" 2> /dev/null
154mkdir -p "$PREV_INSTALLATION" 2> /dev/null # The above actually removes the current directory and parents!
155rmdir "$PREV_INSTALLATION" 2> /dev/null
156rm -f "$CONFIG_DIR/$CONFIG" 2> /dev/null
157rm -f "$CONFIG_DIR/$CONFIG_FILES" 2> /dev/null
158rmdir "$CONFIG_DIR" 2> /dev/null
159
160update-mime-database /usr/share/mime >/dev/null 2>&1
161
162if [ -z "$VBOX_NO_UNINSTALL_MESSAGE" ]; then
163 [ -n "$INSTALL_REV" ] && INSTALL_REV=" r$INSTALL_REV"
164 info "VirtualBox $INSTALL_VER$INSTALL_REV has been removed successfully."
165 log "Successfully $INSTALL_VER$INSTALL_REV removed VirtualBox."
166fi
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