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