VirtualBox

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

Last change on this file since 31808 was 31768, checked in by vboxsync, 14 years ago

Linux installer: allow to start the web service via script, further work required

  • Property svn:eol-style set to LF
File size: 4.6 KB
Line 
1#!/bin/sh
2
3. `dirname $0`/routines.sh
4
5if [ -z "$ro_LOG_FILE" ]; then
6 create_log "/var/log/vbox-uninstall.log"
7fi
8
9if [ -z "VBOX_NO_UNINSTALL_MESSAGE" ]; then
10 info "Uninstalling VirtualBox"
11 log "Uninstalling VirtualBox"
12 log ""
13fi
14
15[ -z "$DKMS" ] && DKMS=`which dkms 2> /dev/null`
16[ -z "$CONFIG_DIR" ] && CONFIG_DIR="/etc/vbox"
17[ -z "$CONFIG" ] && CONFIG="vbox.cfg"
18[ -z "$CONFIG_FILES" ] && CONFIG_FILES="filelist"
19[ -z "$DEFAULT_FILES" ] && DEFAULT_FILES=`pwd`/deffiles
20
21# Terminate Server and VBoxNetDHCP if running
22terminate_proc VBoxSVC
23terminate_proc VBoxNetDHCP
24
25# Find previous installation
26if [ -r $CONFIG_DIR/$CONFIG ]; then
27 . $CONFIG_DIR/$CONFIG
28 PREV_INSTALLATION=$INSTALL_DIR
29fi
30
31# Remove previous installation
32if [ "$PREV_INSTALLATION" = "" ]; then
33 log "Unable to find a VirtualBox installation, giving up."
34 abort "Couldn't find a VirtualBox installation to uninstall."
35fi
36
37# Stop the web service
38stop_init_script vboxweb-service
39delrunlevel vboxweb-service > /dev/null 2>&1
40remove_init_script vboxweb-service
41# Stop kernel module and uninstall runlevel script
42stop_init_script vboxdrv
43delrunlevel vboxdrv > /dev/null 2>&1
44remove_init_script vboxdrv
45# Stop host networking and uninstall runlevel script (obsolete)
46stop_init_script vboxnet
47delrunlevel vboxnet > /dev/null 2>&1
48remove_init_script vboxnet
49# Remove kernel module installed
50if [ -n "$DKMS" ]; then
51 $DKMS remove -m vboxdrv -v $INSTALL_VER --all > /dev/null 2>&1
52fi
53if [ -z "$VBOX_DONT_REMOVE_OLD_MODULES" ]; then
54 find /lib/modules/`uname -r` -name "vboxdrv\.*" 2>/dev/null|xargs rm -f 2> /dev/null
55 find /lib/modules/`uname -r` -name "vboxnetflt\.*" 2>/dev/null|xargs rm -f 2> /dev/null
56 find /lib/modules/`uname -r` -name "vboxnetadp\.*" 2>/dev/null|xargs rm -f 2> /dev/null
57 # Remove directories we have installed to in the past
58 find /lib/modules/`uname -r` -name vbox\* 2>/dev/null|xargs rmdir -p 2> /dev/null
59 find /lib/modules/`uname -r` -name misc\* 2>/dev/null|xargs rmdir -p 2> /dev/null
60 rm -f /usr/src/vboxdrv-$INSTALL_VER 2> /dev/null
61 rm -f /usr/src/vboxnetflt-$INSTALL_VER 2> /dev/null
62 rm -f /usr/src/vboxnetadp-$INSTALL_VER 2> /dev/null
63fi
64
65# Remove symlinks
66rm -f /usr/bin/VirtualBox 2> /dev/null
67rm -f /usr/bin/VBoxManage 2> /dev/null
68rm -f /usr/bin/VBoxSDL 2> /dev/null
69rm -f /usr/bin/VBoxVRDP 2> /dev/null
70rm -f /usr/bin/VBoxHeadless 2> /dev/null
71rm -f /usr/bin/VBoxNetDHCP 2> /dev/null
72rm -f /usr/bin/vboxwebsrv 2> /dev/null
73rm -f /usr/bin/VBoxAddIF 2> /dev/null
74rm -f /usr/bin/VBoxDeleteIf 2> /dev/null
75rm -f /usr/bin/VBoxTunctl 2> /dev/null
76rm -f /usr/share/pixmaps/VBox.png 2> /dev/null
77rm -f /usr/share/applications/virtualbox.desktop 2> /dev/null
78rm -f /usr/bin/rdesktop-vrdp 2> /dev/null
79rm -f $PREV_INSTALLATION/components/VBoxVMM.so
80rm -f $PREV_INSTALLATION/components/VBoxREM.so
81rm -f $PREV_INSTALLATION/components/VBoxRT.so
82rm -f $PREV_INSTALLATION/components/VBoxDDU.so
83rm -f $PREV_INSTALLATION/components/VBoxXPCOM.so
84
85# Remove udev description file
86if [ -f /etc/udev/rules.d/60-vboxdrv.rules ]; then
87 rm -f /etc/udev/rules.d/60-vboxdrv.rules 2> /dev/null
88fi
89if [ -f /etc/udev/rules.d/10-vboxdrv.rules ]; then
90 rm -f /etc/udev/rules.d/10-vboxdrv.rules 2> /dev/null
91fi
92
93cwd=`pwd`
94if [ -f $PREV_INSTALLATION/src/Makefile ]; then
95 cd $PREV_INSTALLATION/src
96 make clean > /dev/null 2>&1
97fi
98if [ -f $PREV_INSTALLATION/src/vboxdrv/Makefile ]; then
99 cd $PREV_INSTALLATION/src/vboxdrv
100 make clean > /dev/null 2>&1
101fi
102if [ -f $PREV_INSTALLATION/src/vboxnetflt/Makefile ]; then
103 cd $PREV_INSTALLATION/src/vboxnetflt
104 make clean > /dev/null 2>&1
105fi
106if [ -f $PREV_INSTALLATION/src/vboxnetadp/Makefile ]; then
107 cd $PREV_INSTALLATION/src/vboxnetadp
108 make clean > /dev/null 2>&1
109fi
110cd $PREV_INSTALLATION
111if [ -r $CONFIG_DIR/$CONFIG_FILES ]; then
112 rm -f `cat $CONFIG_DIR/$CONFIG_FILES` 2> /dev/null
113elif [ -n "$DEFAULT_FILES" -a -r "$DEFAULT_FILES" ]; then
114 DEFAULT_FILE_NAMES=""
115 . $DEFAULT_FILES
116 for i in "$DEFAULT_FILE_NAMES"; do
117 rm -f $i 2> /dev/null
118 done
119fi
120for file in `find $PREV_INSTALLATION 2> /dev/null`; do
121 rmdir -p $file 2> /dev/null
122done
123cd $cwd
124mkdir -p $PREV_INSTALLATION 2> /dev/null # The above actually removes the current directory and parents!
125rmdir $PREV_INSTALLATION 2> /dev/null
126rm -r $CONFIG_DIR/$CONFIG 2> /dev/null
127
128if [ -z "$VBOX_NO_UNINSTALL_MESSAGE" ]; then
129 rm -r $CONFIG_DIR/$CONFIG_FILES 2> /dev/null
130 rmdir $CONFIG_DIR 2> /dev/null
131 [ -n "$INSTALL_REV" ] && INSTALL_REV=" r$INSTALL_REV"
132 info "VirtualBox $INSTALL_VER$INSTALL_REV has been removed successfully."
133 log "Successfully $INSTALL_VER$INSTALL_REV removed VirtualBox."
134fi
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