Changeset 86306 in vbox for trunk/src/VBox/Installer/darwin
- Timestamp:
- Sep 26, 2020 2:36:12 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh
r82968 r86306 71 71 VBOXDRV="VBoxDrv" 72 72 VBOXUSB="VBoxUSB" 73 MACOS_VERS=$(sw_vers -productVersion) 73 74 74 75 # … … 97 98 # 98 99 if [ $VBOX_RC -eq 0 ]; then 99 if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then 100 ConsoleMessage "Error: ${VBOXDRV}.kext is already loaded" 101 VBOX_RC=1 102 fi 103 if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then 104 ConsoleMessage "Error: ${VBOXUSB}.kext is already loaded" 105 VBOX_RC=1 106 fi 107 if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then 108 ConsoleMessage "Error: VBoxNetFlt.kext is already loaded" 109 VBOX_RC=1 110 fi 111 if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then 112 ConsoleMessage "Error: VBoxNetAdp.kext is already loaded" 113 VBOX_RC=1 100 if [[ ${MACOS_VERS} != 11.* ]]; then 101 if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then 102 ConsoleMessage "Error: ${VBOXDRV}.kext is already loaded" 103 VBOX_RC=1 104 fi 105 if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then 106 ConsoleMessage "Error: ${VBOXUSB}.kext is already loaded" 107 VBOX_RC=1 108 fi 109 if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then 110 ConsoleMessage "Error: VBoxNetFlt.kext is already loaded" 111 VBOX_RC=1 112 fi 113 if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then 114 ConsoleMessage "Error: VBoxNetAdp.kext is already loaded" 115 VBOX_RC=1 116 fi 117 else 118 # 119 # Use kmutil directly on BigSur or grep will erroneously trigger because kextstat dumps the kmutil 120 # invocation to stdout... 121 # 122 if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then 123 ConsoleMessage "Error: ${VBOXDRV}.kext is already loaded" 124 VBOX_RC=1 125 fi 126 if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then 127 ConsoleMessage "Error: ${VBOXUSB}.kext is already loaded" 128 VBOX_RC=1 129 fi 130 if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then 131 ConsoleMessage "Error: VBoxNetFlt.kext is already loaded" 132 VBOX_RC=1 133 fi 134 if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then 135 ConsoleMessage "Error: VBoxNetAdp.kext is already loaded" 136 VBOX_RC=1 137 fi 114 138 fi 115 139 fi … … 119 143 # 120 144 if [ $VBOX_RC -eq 0 ]; then 121 ConsoleMessage "Loading ${VBOXDRV}.kext" 122 if ! kextload "/Library/Application Support/VirtualBox/${VBOXDRV}.kext"; then 123 ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/${VBOXDRV}.kext" 124 VBOX_RC=1 125 fi 126 127 ConsoleMessage "Loading ${VBOXUSB}.kext" 128 if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/${VBOXUSB}.kext"; then 129 ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/${VBOXUSB}.kext" 130 VBOX_RC=1 131 fi 132 133 ConsoleMessage "Loading VBoxNetFlt.kext" 134 if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/VBoxNetFlt.kext"; then 135 ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/VBoxNetFlt.kext" 136 VBOX_RC=1 137 fi 138 139 ConsoleMessage "Loading VBoxNetAdp.kext" 140 if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/VBoxNetAdp.kext"; then 141 ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/VBoxNetAdp.kext" 142 VBOX_RC=1 145 if [[ ${MACOS_VERS} != 11.* ]]; then 146 ConsoleMessage "Loading ${VBOXDRV}.kext" 147 if ! kextload "/Library/Application Support/VirtualBox/${VBOXDRV}.kext"; then 148 ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/${VBOXDRV}.kext" 149 VBOX_RC=1 150 fi 151 152 ConsoleMessage "Loading ${VBOXUSB}.kext" 153 if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/${VBOXUSB}.kext"; then 154 ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/${VBOXUSB}.kext" 155 VBOX_RC=1 156 fi 157 158 ConsoleMessage "Loading VBoxNetFlt.kext" 159 if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/VBoxNetFlt.kext"; then 160 ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/VBoxNetFlt.kext" 161 VBOX_RC=1 162 fi 163 164 ConsoleMessage "Loading VBoxNetAdp.kext" 165 if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/VBoxNetAdp.kext"; then 166 ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/VBoxNetAdp.kext" 167 VBOX_RC=1 168 fi 169 else 170 # 171 # On BigSur we can only load by bundle ID because the drivers are baked into a kext collection image 172 # and the real path is never loaded actually. 173 # 174 ConsoleMessage "Loading ${VBOXDRV}.kext" 175 if ! kmutil load -b org.virtualbox.kext.VBoxDrv; then 176 ConsoleMessage "Error: Failed to load org.virtualbox.kext.VBoxDrv" 177 VBOX_RC=1 178 fi 179 180 ConsoleMessage "Loading ${VBOXUSB}.kext" 181 if ! kmutil load -b org.virtualbox.kext.VBoxUSB; then 182 ConsoleMessage "Error: Failed to load org.virtualbox.kext.VBoxUSB" 183 VBOX_RC=1 184 fi 185 186 ConsoleMessage "Loading VBoxNetFlt.kext" 187 if ! kmutil load -b org.virtualbox.kext.VBoxNetFlt; then 188 ConsoleMessage "Error: Failed to load org.virtualbox.kext.VBoxNetFlt" 189 VBOX_RC=1 190 fi 191 192 ConsoleMessage "Loading VBoxNetAdp.kext" 193 if ! kmutil load -b org.virtualbox.kext.VBoxNetAdp; then 194 ConsoleMessage "Error: Failed to load org.virtualbox.kext.VBoxNetAdp" 195 VBOX_RC=1 196 fi 143 197 fi 144 198 … … 167 221 VBOXDRV="VBoxDrv" 168 222 VBOXUSB="VBoxUSB" 169 170 if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then 171 ConsoleMessage "Unloading ${VBOXUSB}.kext" 172 if ! kextunload -m org.virtualbox.kext.VBoxUSB; then 173 ConsoleMessage "Error: Failed to unload VBoxUSB.kext" 174 VBOX_RC=1 175 fi 176 fi 177 178 if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then 179 ConsoleMessage "Unloading VBoxNetFlt.kext" 180 if ! kextunload -m org.virtualbox.kext.VBoxNetFlt; then 181 ConsoleMessage "Error: Failed to unload VBoxNetFlt.kext" 182 VBOX_RC=1 183 fi 184 fi 185 186 if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then 187 ConsoleMessage "Unloading VBoxNetAdp.kext" 188 if ! kextunload -m org.virtualbox.kext.VBoxNetAdp; then 189 ConsoleMessage "Error: Failed to unload VBoxNetAdp.kext" 190 VBOX_RC=1 191 fi 192 fi 193 194 # This must come last because of dependencies. 195 if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then 196 ConsoleMessage "Unloading ${VBOXDRV}.kext" 197 if ! kextunload -m org.virtualbox.kext.VBoxDrv; then 198 ConsoleMessage "Error: Failed to unload VBoxDrv.kext" 199 VBOX_RC=1 223 MACOS_VERS=$(sw_vers -productVersion) 224 225 if [[ ${MACOS_VERS} != 11.* ]]; then 226 if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then 227 ConsoleMessage "Unloading ${VBOXUSB}.kext" 228 if ! kextunload -m org.virtualbox.kext.VBoxUSB; then 229 ConsoleMessage "Error: Failed to unload VBoxUSB.kext" 230 VBOX_RC=1 231 fi 232 fi 233 234 if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then 235 ConsoleMessage "Unloading VBoxNetFlt.kext" 236 if ! kextunload -m org.virtualbox.kext.VBoxNetFlt; then 237 ConsoleMessage "Error: Failed to unload VBoxNetFlt.kext" 238 VBOX_RC=1 239 fi 240 fi 241 242 if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then 243 ConsoleMessage "Unloading VBoxNetAdp.kext" 244 if ! kextunload -m org.virtualbox.kext.VBoxNetAdp; then 245 ConsoleMessage "Error: Failed to unload VBoxNetAdp.kext" 246 VBOX_RC=1 247 fi 248 fi 249 250 # This must come last because of dependencies. 251 if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then 252 ConsoleMessage "Unloading ${VBOXDRV}.kext" 253 if ! kextunload -m org.virtualbox.kext.VBoxDrv; then 254 ConsoleMessage "Error: Failed to unload VBoxDrv.kext" 255 VBOX_RC=1 256 fi 257 fi 258 else 259 if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then 260 ConsoleMessage "Unloading ${VBOXUSB}.kext" 261 if ! kmutil unload -b org.virtualbox.kext.VBoxUSB; then 262 ConsoleMessage "Error: Failed to unload VBoxUSB.kext" 263 VBOX_RC=1 264 fi 265 fi 266 267 if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then 268 ConsoleMessage "Unloading VBoxNetFlt.kext" 269 if ! kmutil unload -b org.virtualbox.kext.VBoxNetFlt; then 270 ConsoleMessage "Error: Failed to unload VBoxNetFlt.kext" 271 VBOX_RC=1 272 fi 273 fi 274 275 if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then 276 ConsoleMessage "Unloading VBoxNetAdp.kext" 277 if ! kmutil unload -b org.virtualbox.kext.VBoxNetAdp; then 278 ConsoleMessage "Error: Failed to unload VBoxNetAdp.kext" 279 VBOX_RC=1 280 fi 281 fi 282 283 # This must come last because of dependencies. 284 if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then 285 ConsoleMessage "Unloading ${VBOXDRV}.kext" 286 if ! kmutil unload -b org.virtualbox.kext.VBoxDrv; then 287 ConsoleMessage "Error: Failed to unload VBoxDrv.kext" 288 VBOX_RC=1 289 fi 200 290 fi 201 291 fi
Note:
See TracChangeset
for help on using the changeset viewer.