VirtualBox_Uninstall.tool revision 2009785c2bc1d376c4919f55ddba552a22e1ce26
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd# VirtualBox Uninstaller Script.
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd# Copyright (C) 2007-2010 Oracle Corporation
0066eddda7203f6345b56f77d146a759298dc635gryzor# This file is part of VirtualBox Open Source Edition (OSE), as
0066eddda7203f6345b56f77d146a759298dc635gryzor# available from http://www.virtualbox.org. This file is free software;
0066eddda7203f6345b56f77d146a759298dc635gryzor# you can redistribute it and/or modify it under the terms of the GNU
0066eddda7203f6345b56f77d146a759298dc635gryzor# General Public License (GPL) as published by the Free Software
6ae232055d4d8a97267517c5e50074c2c819941and# Foundation, in version 2 as it comes in the "COPYING" file of the
40f659ca3ad0b434256bb0af6170bbcdcf5e2cfdyoshiki# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
6ae232055d4d8a97267517c5e50074c2c819941and# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd# Override any funny stuff from the user.
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi# Display a simple welcome message first.
echo "Usage: uninstall.sh [--unattended]"
test -f "${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist" && my_files="$my_files ${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist"
test -d /Library/StartupItems/VirtualBox/ && my_directories="$my_directories /Library/StartupItems/VirtualBox/"
test -d /Library/Receipts/VBoxStartupItems.pkg/ && my_directories="$my_directories /Library/Receipts/VBoxStartupItems.pkg/"
test -d /Library/Extensions/VBoxDrv.kext/ && my_directories="$my_directories /Library/Extensions/VBoxDrv.kext/"
test -d /Library/Extensions/VBoxUSB.kext/ && my_directories="$my_directories /Library/Extensions/VBoxUSB.kext/"
test -d /Library/Extensions/VBoxNetFlt.kext/ && my_directories="$my_directories /Library/Extensions/VBoxNetFlt.kext/"
test -d /Library/Extensions/VBoxNetAdp.kext/ && my_directories="$my_directories /Library/Extensions/VBoxNetAdp.kext/"
test -d /Library/Extensions/VBoxDrvTiger.kext/ && my_directories="$my_directories /Library/Extensions/VBoxDrvTiger.kext/"
test -d /Library/Extensions/VBoxUSBTiger.kext/ && my_directories="$my_directories /Library/Extensions/VBoxUSBTiger.kext/"
test -d /Library/Receipts/VBoxKEXTs.pkg/ && my_directories="$my_directories /Library/Receipts/VBoxKEXTs.pkg/"
test -d /Library/Receipts/VirtualBoxCLI.pkg/ && my_directories="$my_directories /Library/Receipts/VirtualBoxCLI.pkg/"
test -d /Applications/VirtualBox.app/ && my_directories="$my_directories /Applications/VirtualBox.app/"
test -d /Library/Receipts/VirtualBox.pkg/ && my_directories="$my_directories /Library/Receipts/VirtualBox.pkg/"
test -d /Library/Receipts/VBoxDrv.pkg/ && my_directories="$my_directories /Library/Receipts/VBoxDrv.pkg/"
test -d /Library/Receipts/VBoxUSB.pkg/ && my_directories="$my_directories /Library/Receipts/VBoxUSB.pkg/"
test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py && my_files="$my_files /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py"
test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc && my_files="$my_files /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc"
test -f /Library/Python/$p/site-packages/vboxapi/__init__.py && my_files="$my_files /Library/Python/$p/site-packages/vboxapi/__init__.py"
test -f /Library/Python/$p/site-packages/vboxapi/__init__.pyc && my_files="$my_files /Library/Python/$p/site-packages/vboxapi/__init__.pyc"
test -f /Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info && my_files="$my_files /Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info"
test -d /Library/Python/$p/site-packages/vboxapi/ && my_directories="$my_directories /Library/Python/$p/site-packages/vboxapi/"
for kext in org.virtualbox.kext.VBoxUSB org.virtualbox.kext.VBoxNetFlt org.virtualbox.kext.VBoxNetAdp org.virtualbox.kext.VBoxDrv; do
my_processes="`ps -axco 'pid uid command' | grep -wEe '(VirtualBox|VirtualBoxVM|VBoxManage|VBoxHeadless|vboxwebsrv|VBoxXPCOMIPCD|VBoxSVC|VBoxNetDHCP)' | grep -vw grep | grep -vw VirtualBox_Uninstall.tool | tr '\n' '\a'`";
if test -n "$my_processes"; then
read my_answer
echo "Aborting uninstall. (answer: '$my_answer')".
if test -n "$my_kexts"; then
read my_answer
echo "Aborting uninstall. (answer: '$my_answer')".
my_rc=$?
echo "An error occured durning 'sudo rm', there should be a message above. (rc=$my_rc)"
my_rc2=$?
echo "An error occured durning 'sudo /sbin/kextunload -m $kext', there should be a message above. (rc=$my_rc2)"