[31638] | 1 | #!/bin/sh
|
---|
[32183] | 2 | #
|
---|
| 3 | # Oracle VM VirtualBox
|
---|
| 4 | # VirtualBox linux uninstallation script
|
---|
[31638] | 5 |
|
---|
[32183] | 6 | #
|
---|
[98103] | 7 | # Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
[32183] | 8 | #
|
---|
[96407] | 9 | # This file is part of VirtualBox base platform packages, as
|
---|
| 10 | # available from https://www.virtualbox.org.
|
---|
[32183] | 11 | #
|
---|
[96407] | 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 | #
|
---|
[32183] | 27 |
|
---|
[58324] | 28 | # The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
|
---|
| 29 | TARGET=`readlink -e -- "${0}"` || exit 1
|
---|
| 30 | MY_PATH="${TARGET%/[!/]*}"
|
---|
| 31 | . "${MY_PATH}/routines.sh"
|
---|
[31638] | 32 |
|
---|
| 33 | if [ -z "$ro_LOG_FILE" ]; then
|
---|
| 34 | create_log "/var/log/vbox-uninstall.log"
|
---|
| 35 | fi
|
---|
| 36 |
|
---|
| 37 | if [ -z "VBOX_NO_UNINSTALL_MESSAGE" ]; then
|
---|
| 38 | info "Uninstalling VirtualBox"
|
---|
| 39 | log "Uninstalling VirtualBox"
|
---|
| 40 | log ""
|
---|
| 41 | fi
|
---|
| 42 |
|
---|
[32326] | 43 | check_root
|
---|
| 44 |
|
---|
[31638] | 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
|
---|
[92628] | 51 | if [ -r "$CONFIG_DIR/$CONFIG" ]; then
|
---|
| 52 | . "$CONFIG_DIR/$CONFIG"
|
---|
| 53 | PREV_INSTALLATION="$INSTALL_DIR"
|
---|
[31638] | 54 | fi
|
---|
| 55 |
|
---|
| 56 | # Remove previous installation
|
---|
| 57 | if [ "$PREV_INSTALLATION" = "" ]; then
|
---|
| 58 | log "Unable to find a VirtualBox installation, giving up."
|
---|
| 59 | abort "Couldn't find a VirtualBox installation to uninstall."
|
---|
| 60 | fi
|
---|
| 61 |
|
---|
[57711] | 62 | # Do pre-removal common to all installer types, currently service script
|
---|
| 63 | # clean-up.
|
---|
[58324] | 64 | "${MY_PATH}/prerm-common.sh" || exit 1
|
---|
[57711] | 65 |
|
---|
[31638] | 66 | # Remove kernel module installed
|
---|
| 67 | if [ -z "$VBOX_DONT_REMOVE_OLD_MODULES" ]; then
|
---|
[92628] | 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
|
---|
[31638] | 73 | fi
|
---|
| 74 |
|
---|
| 75 | # Remove symlinks
|
---|
[33231] | 76 | rm -f \
|
---|
| 77 | /usr/bin/VirtualBox \
|
---|
[76972] | 78 | /usr/bin/VirtualBoxVM \
|
---|
[33231] | 79 | /usr/bin/VBoxManage \
|
---|
| 80 | /usr/bin/VBoxSDL \
|
---|
| 81 | /usr/bin/VBoxVRDP \
|
---|
| 82 | /usr/bin/VBoxHeadless \
|
---|
[54030] | 83 | /usr/bin/VBoxDTrace \
|
---|
[89669] | 84 | /usr/bin/VBoxAudioTest \
|
---|
[61998] | 85 | /usr/bin/VBoxBugReport \
|
---|
[38340] | 86 | /usr/bin/VBoxBalloonCtrl \
|
---|
[42119] | 87 | /usr/bin/VBoxAutostart \
|
---|
[33231] | 88 | /usr/bin/VBoxNetDHCP \
|
---|
[47894] | 89 | /usr/bin/VBoxNetNAT \
|
---|
[33231] | 90 | /usr/bin/vboxwebsrv \
|
---|
[51294] | 91 | /usr/bin/vbox-img \
|
---|
[81386] | 92 | /usr/bin/vboximg-mount \
|
---|
[33231] | 93 | /usr/bin/VBoxAddIF \
|
---|
| 94 | /usr/bin/VBoxDeleteIf \
|
---|
| 95 | /usr/bin/VBoxTunctl \
|
---|
| 96 | /usr/bin/virtualbox \
|
---|
[76972] | 97 | /usr/bin/virtualboxvm \
|
---|
[33231] | 98 | /usr/share/pixmaps/VBox.png \
|
---|
[36777] | 99 | /usr/share/pixmaps/virtualbox.png \
|
---|
[33231] | 100 | /usr/share/applications/virtualbox.desktop \
|
---|
[91857] | 101 | /usr/share/applications/virtualboxvm.desktop \
|
---|
[34522] | 102 | /usr/share/mime/packages/virtualbox.xml \
|
---|
[33231] | 103 | /usr/bin/rdesktop-vrdp \
|
---|
| 104 | /usr/bin/virtualbox \
|
---|
| 105 | /usr/bin/vboxmanage \
|
---|
| 106 | /usr/bin/vboxsdl \
|
---|
| 107 | /usr/bin/vboxheadless \
|
---|
[54030] | 108 | /usr/bin/vboxdtrace \
|
---|
[89669] | 109 | /usr/bin/vboxaudiotest \
|
---|
[61998] | 110 | /usr/bin/vboxbugreport \
|
---|
[92628] | 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" \
|
---|
[33231] | 119 | 2> /dev/null
|
---|
[31638] | 120 |
|
---|
| 121 | cwd=`pwd`
|
---|
[92628] | 122 | if [ -f "$PREV_INSTALLATION/src/Makefile" ]; then
|
---|
| 123 | cd "$PREV_INSTALLATION/src"
|
---|
[31638] | 124 | make clean > /dev/null 2>&1
|
---|
| 125 | fi
|
---|
[92628] | 126 | if [ -f "$PREV_INSTALLATION/src/vboxdrv/Makefile" ]; then
|
---|
| 127 | cd "$PREV_INSTALLATION/src/vboxdrv"
|
---|
[31638] | 128 | make clean > /dev/null 2>&1
|
---|
| 129 | fi
|
---|
[92628] | 130 | if [ -f "$PREV_INSTALLATION/src/vboxnetflt/Makefile" ]; then
|
---|
| 131 | cd "$PREV_INSTALLATION/src/vboxnetflt"
|
---|
[31638] | 132 | make clean > /dev/null 2>&1
|
---|
| 133 | fi
|
---|
[92628] | 134 | if [ -f "$PREV_INSTALLATION/src/vboxnetadp/Makefile" ]; then
|
---|
| 135 | cd "$PREV_INSTALLATION/src/vboxnetadp"
|
---|
[31638] | 136 | make clean > /dev/null 2>&1
|
---|
| 137 | fi
|
---|
[92628] | 138 | if [ -f "$PREV_INSTALLATION/src/vboxpci/Makefile" ]; then
|
---|
| 139 | cd "$PREV_INSTALLATION/src/vboxpci"
|
---|
[57980] | 140 | make clean > /dev/null 2>&1
|
---|
| 141 | fi
|
---|
[92628] | 142 | cd "$PREV_INSTALLATION"
|
---|
| 143 | if [ -r "$CONFIG_DIR/$CONFIG_FILES" ]; then
|
---|
| 144 | rm -f `cat "$CONFIG_DIR/$CONFIG_FILES"` 2> /dev/null
|
---|
[31638] | 145 | elif [ -n "$DEFAULT_FILES" -a -r "$DEFAULT_FILES" ]; then
|
---|
| 146 | DEFAULT_FILE_NAMES=""
|
---|
[92628] | 147 | . "$DEFAULT_FILES"
|
---|
| 148 | rm -f $DEFAULT_FILE_NAMES 2> /dev/null
|
---|
[31638] | 149 | fi
|
---|
[92628] | 150 | for file in `find "$PREV_INSTALLATION" 2> /dev/null`; do
|
---|
| 151 | rmdir -p "$file" 2> /dev/null
|
---|
[31638] | 152 | done
|
---|
[95475] | 153 | cd "$cwd" 2> /dev/null
|
---|
[92628] | 154 | mkdir -p "$PREV_INSTALLATION" 2> /dev/null # The above actually removes the current directory and parents!
|
---|
| 155 | rmdir "$PREV_INSTALLATION" 2> /dev/null
|
---|
| 156 | rm -f "$CONFIG_DIR/$CONFIG" 2> /dev/null
|
---|
| 157 | rm -f "$CONFIG_DIR/$CONFIG_FILES" 2> /dev/null
|
---|
| 158 | rmdir "$CONFIG_DIR" 2> /dev/null
|
---|
[31638] | 159 |
|
---|
[92628] | 160 | update-mime-database /usr/share/mime >/dev/null 2>&1
|
---|
| 161 |
|
---|
[31638] | 162 | if [ -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."
|
---|
| 166 | fi
|
---|