VirtualBoxStartup.sh revision 66ab05d147fcb24a5fec1cd3c37a1799db26c804
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# Startup service for loading the kernel extensions and select the set of VBox
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# binaries that matches the kernel architecture.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# Copyright (C) 2007-2013 Oracle Corporation
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# available from http://www.virtualbox.org. This file is free software;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# you can redistribute it and/or modify it under the terms of the GNU
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# General Public License (GPL) as published by the Free Software
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncif false; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync # Fake the startup item functions we're using.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync while true;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync for VBOX_TRG in `ls /Applications/VirtualBox.app/Contents/MacOS/*-${VBOX_ARCH}`;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync VBOX_LINKNAME=`echo "$VBOX_TRG" | sed -e 's|-'"${VBOX_ARCH}"'$||' `
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: ln -vh $VBOX_TRG $VBOX_LINKNAME failed"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Script error VBOX_TRG=$VBOX_TRG"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if [ ! -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" ]; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: /Library/Application Support/VirtualBox/${VBOXDRV}.kext is missing"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if [ ! -d "/Library/Application Support/VirtualBox/${VBOXUSB}.kext" ]; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: /Library/Application Support/VirtualBox/${VBOXUSB}.kext is missing"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if [ ! -d "/Library/Application Support/VirtualBox/VBoxNetFlt.kext" ]; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: /Library/Application Support/VirtualBox/VBoxNetFlt.kext is missing"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if [ ! -d "/Library/Application Support/VirtualBox/VBoxNetAdp.kext" ]; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: /Library/Application Support/VirtualBox/VBoxNetAdp.kext is missing"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if [ $VBOX_RC -eq 0 ]; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: ${VBOXDRV}.kext is already loaded"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: ${VBOXUSB}.kext is already loaded"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: VBoxNetFlt.kext is already loaded"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: VBoxNetAdp.kext is already loaded"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if [ $VBOX_RC -eq 0 ]; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if ! kextload "/Library/Application Support/VirtualBox/${VBOXDRV}.kext"; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/${VBOXDRV}.kext"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/${VBOXUSB}.kext"; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/${VBOXUSB}.kext"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/VBoxNetFlt.kext"; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/VBoxNetFlt.kext"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/VBoxNetAdp.kext"; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/VBoxNetAdp.kext"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if [ $VBOX_RC -ne 0 ]; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if ! kextunload -m org.virtualbox.kext.VBoxUSB; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Failed to unload VBoxUSB.kext"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if ! kextunload -m org.virtualbox.kext.VBoxNetFlt; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Failed to unload VBoxNetFlt.kext"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if ! kextunload -m org.virtualbox.kext.VBoxNetAdp; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Failed to unload VBoxNetAdp.kext"
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if ! kextunload -m org.virtualbox.kext.VBoxDrv; then
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ConsoleMessage "Error: Failed to unload VBoxDrv.kext"