Changeset 48924 in vbox for trunk/src/VBox/Installer/darwin/DiskImage
- Timestamp:
- Oct 7, 2013 1:49:09 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool
r47894 r48924 1 #!/bin/sh 2 # 1 #!/bin/bash 2 # $Id$ 3 ## @file 3 4 # VirtualBox Uninstaller Script. 5 # 6 4 7 # 5 8 # Copyright (C) 2007-2013 Oracle Corporation … … 46 49 # Note: Do NOT attempt adding directories or filenames with spaces! 47 50 # 48 my_directories="" 49 my_files="" 51 declare -a my_directories 52 declare -a my_files 50 53 51 54 # Users files first 52 test -f "${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist" && my_files="$my_files ${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist" 53 54 test -d /Library/StartupItems/VirtualBox/ && my_directories="$my_directories /Library/StartupItems/VirtualBox/" 55 test -d /Library/Receipts/VBoxStartupItems.pkg/ && my_directories="$my_directories /Library/Receipts/VBoxStartupItems.pkg/" 56 57 test -d /Library/Extensions/VBoxDrv.kext/ && my_directories="$my_directories /Library/Extensions/VBoxDrv.kext/" 58 test -d /Library/Extensions/VBoxUSB.kext/ && my_directories="$my_directories /Library/Extensions/VBoxUSB.kext/" 59 test -d /Library/Extensions/VBoxNetFlt.kext/ && my_directories="$my_directories /Library/Extensions/VBoxNetFlt.kext/" 60 test -d /Library/Extensions/VBoxNetAdp.kext/ && my_directories="$my_directories /Library/Extensions/VBoxNetAdp.kext/" 55 test -f "${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist" && my_files+=("${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist") 56 57 test -d /Library/StartupItems/VirtualBox/ && my_directories+=("/Library/StartupItems/VirtualBox/") 58 test -d /Library/Receipts/VBoxStartupItems.pkg/ && my_directories+=("/Library/Receipts/VBoxStartupItems.pkg/") 59 60 test -d "/Library/Application Support/VirtualBox/VBoxDrv.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxDrv.kext/") 61 test -d "/Library/Application Support/VirtualBox/VBoxUSB.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxUSB.kext/") 62 test -d "/Library/Application Support/VirtualBox/VBoxNetFlt.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxNetFlt.kext/") 63 test -d "/Library/Application Support/VirtualBox/VBoxNetAdp.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxNetAdp.kext/") 64 # Pre 4.3.0rc1 locations: 65 test -d /Library/Extensions/VBoxDrv.kext/ && my_directories+=("/Library/Extensions/VBoxDrv.kext/") 66 test -d /Library/Extensions/VBoxUSB.kext/ && my_directories+=("/Library/Extensions/VBoxUSB.kext/") 67 test -d /Library/Extensions/VBoxNetFlt.kext/ && my_directories+=("/Library/Extensions/VBoxNetFlt.kext/") 68 test -d /Library/Extensions/VBoxNetAdp.kext/ && my_directories+=("/Library/Extensions/VBoxNetAdp.kext/") 61 69 # Tiger support is obsolete, but we leave it here for a clean removing of older 62 70 # VirtualBox versions 63 test -d /Library/Extensions/VBoxDrvTiger.kext/ && my_directories ="$my_directories /Library/Extensions/VBoxDrvTiger.kext/"64 test -d /Library/Extensions/VBoxUSBTiger.kext/ && my_directories ="$my_directories /Library/Extensions/VBoxUSBTiger.kext/"65 test -d /Library/Receipts/VBoxKEXTs.pkg/ && my_directories ="$my_directories /Library/Receipts/VBoxKEXTs.pkg/"66 67 test -f /usr/bin/VirtualBox && my_files ="$my_files /usr/bin/VirtualBox"68 test -f /usr/bin/VBoxManage && my_files ="$my_files /usr/bin/VBoxManage"69 test -f /usr/bin/VBoxVRDP && my_files ="$my_files /usr/bin/VBoxVRDP"70 test -f /usr/bin/VBoxHeadless && my_files ="$my_files /usr/bin/VBoxHeadless"71 test -f /usr/bin/vboxwebsrv && my_files ="$my_files /usr/bin/vboxwebsrv"72 test -f /usr/bin/VBoxBalloonCtrl && my_files ="$my_files /usr/bin/VBoxBalloonCtrl"73 test -f /usr/bin/VBoxAutostart && my_files ="$my_files /usr/bin/VBoxAutostart"74 test -f /usr/bin/vbox-img && my_files ="$my_files /usr/bin/vbox-img"75 test -d /Library/Receipts/VirtualBoxCLI.pkg/ && my_directories ="$my_directories /Library/Receipts/VirtualBoxCLI.pkg/"76 77 test -d /Applications/VirtualBox.app/ && my_directories ="$my_directories /Applications/VirtualBox.app/"78 test -d /Library/Receipts/VirtualBox.pkg/ && my_directories ="$my_directories /Library/Receipts/VirtualBox.pkg/"71 test -d /Library/Extensions/VBoxDrvTiger.kext/ && my_directories+=("/Library/Extensions/VBoxDrvTiger.kext/") 72 test -d /Library/Extensions/VBoxUSBTiger.kext/ && my_directories+=("/Library/Extensions/VBoxUSBTiger.kext/") 73 test -d /Library/Receipts/VBoxKEXTs.pkg/ && my_directories+=("/Library/Receipts/VBoxKEXTs.pkg/") 74 75 test -f /usr/bin/VirtualBox && my_files+=("/usr/bin/VirtualBox") 76 test -f /usr/bin/VBoxManage && my_files+=("/usr/bin/VBoxManage") 77 test -f /usr/bin/VBoxVRDP && my_files+=("/usr/bin/VBoxVRDP") 78 test -f /usr/bin/VBoxHeadless && my_files+=("/usr/bin/VBoxHeadless") 79 test -f /usr/bin/vboxwebsrv && my_files+=("/usr/bin/vboxwebsrv") 80 test -f /usr/bin/VBoxBalloonCtrl && my_files+=("/usr/bin/VBoxBalloonCtrl") 81 test -f /usr/bin/VBoxAutostart && my_files+=("/usr/bin/VBoxAutostart") 82 test -f /usr/bin/vbox-img && my_files+=("/usr/bin/vbox-img") 83 test -d /Library/Receipts/VirtualBoxCLI.pkg/ && my_directories+=("/Library/Receipts/VirtualBoxCLI.pkg/") 84 85 test -d /Applications/VirtualBox.app/ && my_directories+=("/Applications/VirtualBox.app/") 86 test -d /Library/Receipts/VirtualBox.pkg/ && my_directories+=("/Library/Receipts/VirtualBox.pkg/") 79 87 80 88 # legacy 81 test -d /Library/Receipts/VBoxDrv.pkg/ && my_directories ="$my_directories /Library/Receipts/VBoxDrv.pkg/"82 test -d /Library/Receipts/VBoxUSB.pkg/ && my_directories ="$my_directories /Library/Receipts/VBoxUSB.pkg/"89 test -d /Library/Receipts/VBoxDrv.pkg/ && my_directories+=("/Library/Receipts/VBoxDrv.pkg/") 90 test -d /Library/Receipts/VBoxUSB.pkg/ && my_directories+=("/Library/Receipts/VBoxUSB.pkg/") 83 91 84 92 # python stuff 85 93 python_versions="2.3 2.5 2.6 2.7" 86 94 for p in $python_versions; do 87 test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py && my_files ="$my_files /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py"88 test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc && my_files ="$my_files /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc"89 test -f /Library/Python/$p/site-packages/vboxapi/__init__.py && my_files ="$my_files /Library/Python/$p/site-packages/vboxapi/__init__.py"90 test -f /Library/Python/$p/site-packages/vboxapi/__init__.pyc && my_files ="$my_files /Library/Python/$p/site-packages/vboxapi/__init__.pyc"91 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"92 test -d /Library/Python/$p/site-packages/vboxapi/ && my_directories ="$my_directories /Library/Python/$p/site-packages/vboxapi/"95 test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py && my_files+=("/Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py") 96 test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc && my_files+=("/Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc") 97 test -f /Library/Python/$p/site-packages/vboxapi/__init__.py && my_files+=("/Library/Python/$p/site-packages/vboxapi/__init__.py") 98 test -f /Library/Python/$p/site-packages/vboxapi/__init__.pyc && my_files+=("/Library/Python/$p/site-packages/vboxapi/__init__.pyc") 99 test -f /Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info && my_files+=("/Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info") 100 test -d /Library/Python/$p/site-packages/vboxapi/ && my_directories+=("/Library/Python/$p/site-packages/vboxapi/") 93 101 done 94 102 … … 97 105 # Note that the unload order is significant. 98 106 # 99 my_kexts="" 107 declare -a my_kexts 100 108 for kext in org.virtualbox.kext.VBoxUSB org.virtualbox.kext.VBoxNetFlt org.virtualbox.kext.VBoxNetAdp org.virtualbox.kext.VBoxDrv; do 101 109 if /usr/sbin/kextstat -b $kext -l | grep -q $kext; then 102 my_kexts ="$my_kexts $kext"110 my_kexts+=("$kext") 103 111 fi 104 112 done … … 113 121 # Did we find anything to uninstall? 114 122 # 115 if test -z "$ my_directories" -a -z "$my_files" -a -z "$my_kexts" -a -z "$my_pkgs"; then123 if test -z "${my_directories[*]}" -a -z "${my_files[*]}" -a -z "${my_kexts[*]}" -a -z "$my_pkgs"; then 116 124 echo "No VirtualBox files, directories, KEXTs or packages to uninstall." 117 125 echo "Done." … … 151 159 # and get the user's consent before continuing. 152 160 # 153 if test -n "$ my_files" -o -n "$my_directories"; then161 if test -n "${my_files[*]}" -o -n "${my_directories[*]}"; then 154 162 echo "The following files and directories (bundles) will be removed:" 155 for file in $my_files; do echo " $file"; done 156 for dir in $my_directories; do echo " $dir"; done 157 fi 158 if test -n "$my_kexts"; then 163 for file in "${my_files[@]}"; do echo " $file"; done 164 for dir in "${my_directories[@]}"; do echo " $dir"; done 165 echo "" 166 fi 167 if test -n "${my_kexts[*]}"; then 159 168 echo "And the following KEXTs will be unloaded:" 160 for kext in $my_kexts; do echo " $kext"; done 169 for kext in "${my_kexts[@]}"; do echo " $kext"; done 170 echo "" 161 171 fi 162 172 if test -n "$my_pkgs"; then 163 173 echo "And the traces of following packages will be removed:" 164 174 for kext in $my_pkgs; do echo " $kext"; done 165 fi 166 echo "" 175 echo "" 176 fi 167 177 168 178 if test "$my_default_prompt" != "Yes"; then … … 193 203 echo "" 194 204 195 if test -n "$ my_files" -o -n "$my_directories"; then196 /usr/bin/sudo -p "Please enter %u's password:" /bin/rm -Rf $my_files $my_directories205 if test -n "${my_files[*]}" -o -n "${my_directories[*]}"; then 206 /usr/bin/sudo -p "Please enter %u's password:" /bin/rm -Rf "${my_files[@]}" "${my_directories[@]}" 197 207 my_rc=$? 198 208 if test "$my_rc" -ne 0; then … … 207 217 208 218 my_rc=0 209 for kext in $my_kexts; do219 for kext in "${my_kexts[@]}"; do 210 220 echo unloading $kext 211 221 /usr/bin/sudo -p "Please enter %u's password (unloading $kext):" /sbin/kextunload -m $kext
Note:
See TracChangeset
for help on using the changeset viewer.