load.sh revision 07dfc0801e1df43b76629d72bd2c779ea3195dea
d5d12f5d4455786efdce0a22f09ec396bcb60718vboxsync# For development.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync# Copyright (C) 2006-2007 Sun Microsystems, Inc.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# available from http://www.virtualbox.org. This file is free software;
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# The contents of this file may alternatively be used under the terms
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# of the Common Development and Distribution License Version 1.0
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# VirtualBox OSE distribution, in which case the provisions of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# CDDL are applicable instead of those of the GPL.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# You may elect to license modified versions of this file under the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync# terms and conditions of either the GPL or the CDDL or both.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync# additional information or have any questions.
130a462bf46409a9352467033f92e02e4b249879vboxsyncXNU_VERSION=`LC_ALL=C uname -r | LC_ALL=C cut -d . -f 1`
d5d12f5d4455786efdce0a22f09ec396bcb60718vboxsyncif [ ! -d "$DIR" ]; then
d5d12f5d4455786efdce0a22f09ec396bcb60718vboxsync echo "Cannot find $DIR or it's not a directory..."
3145bb572fc92a2c79eed3da96cff1ce2ea7da59vboxsyncif [ -n "$*" ]; then
9d39fac7876e40b270f64af45852a8f792c6aba1vboxsync# Make sure VBoxUSB is unloaded as it might be using symbols from us.
9d39fac7876e40b270f64af45852a8f792c6aba1vboxsyncif test -n "$LOADED"; then
9d39fac7876e40b270f64af45852a8f792c6aba1vboxsync echo "load.sh: Unloading org.virtualbox.kext.VBoxUSB..."
9d39fac7876e40b270f64af45852a8f792c6aba1vboxsync sudo kextunload -v 6 -b org.virtualbox.kext.VBoxUSB
9d39fac7876e40b270f64af45852a8f792c6aba1vboxsync LOADED=`kextstat -b org.virtualbox.kext.VBoxUSB -l`
9d39fac7876e40b270f64af45852a8f792c6aba1vboxsync if test -n "$LOADED"; then
9d39fac7876e40b270f64af45852a8f792c6aba1vboxsync echo "load.sh: failed to unload org.virtualbox.kext.VBoxUSB, see above..."
9d39fac7876e40b270f64af45852a8f792c6aba1vboxsync echo "load.sh: Successfully unloaded org.virtualbox.kext.VBoxUSB"
c93cb830958ff97bdfff54d92776c1c364a41999vboxsync# Make sure VBoxNetFlt is unloaded as it might be using symbols from us.
c93cb830958ff97bdfff54d92776c1c364a41999vboxsyncLOADED=`kextstat -b org.virtualbox.kext.VBoxNetFlt -l`
c93cb830958ff97bdfff54d92776c1c364a41999vboxsyncif test -n "$LOADED"; then
c93cb830958ff97bdfff54d92776c1c364a41999vboxsync echo "load.sh: Unloading org.virtualbox.kext.VBoxNetFlt..."
c93cb830958ff97bdfff54d92776c1c364a41999vboxsync sudo kextunload -v 6 -b org.virtualbox.kext.VBoxNetFlt
c93cb830958ff97bdfff54d92776c1c364a41999vboxsync LOADED=`kextstat -b org.virtualbox.kext.VBoxNetFlt -l`
c93cb830958ff97bdfff54d92776c1c364a41999vboxsync if test -n "$LOADED"; then
c93cb830958ff97bdfff54d92776c1c364a41999vboxsync echo "load.sh: failed to unload org.virtualbox.kext.VBoxNetFlt, see above..."
c93cb830958ff97bdfff54d92776c1c364a41999vboxsync echo "load.sh: Successfully unloaded org.virtualbox.kext.VBoxNetFlt"
18589e4730562fe0d41783eb53496bea5a47af97vboxsync# Try unload any existing instance first.
18589e4730562fe0d41783eb53496bea5a47af97vboxsyncif test -n "$LOADED"; then
18589e4730562fe0d41783eb53496bea5a47af97vboxsync echo "load.sh: Unloading $BUNDLE..."
18589e4730562fe0d41783eb53496bea5a47af97vboxsync if test -n "$LOADED"; then
18589e4730562fe0d41783eb53496bea5a47af97vboxsync echo "load.sh: failed to unload $BUNDLE, see above..."
18589e4730562fe0d41783eb53496bea5a47af97vboxsync echo "load.sh: Successfully unloaded $BUNDLE"
3ffde73ed2ec311d260d72a61beede079ccf8cf8vboxsync# Copy the .kext to the symbols directory and tweak the kextload options.
3ffde73ed2ec311d260d72a61beede079ccf8cf8vboxsyncif test -n "$VBOX_DARWIN_SYMS"; then
3ffde73ed2ec311d260d72a61beede079ccf8cf8vboxsync echo "load.sh: copying the extension the symbol area..."
18589e4730562fe0d41783eb53496bea5a47af97vboxsync# On smbfs, this might succeed just fine but make no actual changes,
18589e4730562fe0d41783eb53496bea5a47af97vboxsync# so we might have to temporarily copy the driver to a local directory.
18589e4730562fe0d41783eb53496bea5a47af97vboxsync echo "load.sh: chown didn't work on $DIR, using temp location $TMP_DIR/$DRVNAME"
18589e4730562fe0d41783eb53496bea5a47af97vboxsync # clean up first (no sudo rm)
18589e4730562fe0d41783eb53496bea5a47af97vboxsync if test -e "$TMP_DIR"; then
18589e4730562fe0d41783eb53496bea5a47af97vboxsync # make a copy and switch over DIR
18589e4730562fe0d41783eb53496bea5a47af97vboxsyncecho "load.sh: loading $DIR..."
07dfc0801e1df43b76629d72bd2c779ea3195deavboxsync echo "${SCRIPT_NAME}.sh: loading $DIR... (kextutil $OPTS \"$DIR\")"
18589e4730562fe0d41783eb53496bea5a47af97vboxsync#sudo chmod 666 /dev/vboxdrv