loadnetflt.sh revision 5dddec1355c8adc42db429187f2eb18b2bae94be
de4157257515400c2c25373591135f110227b68cvboxsync# For development.
130a462bf46409a9352467033f92e02e4b249879vboxsync# Copyright (C) 2006-2008 Sun Microsystems, Inc.
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# available from http://www.virtualbox.org. This file is free software;
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# you can redistribute it and/or modify it under the terms of the GNU
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# General Public License (GPL) as published by the Free Software
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
b263fac6f6e7fa933c7bfb2a45d598fe8e458c09vboxsync# additional information or have any questions.
130a462bf46409a9352467033f92e02e4b249879vboxsyncXNU_VERSION=`LC_ALL=C uname -r | LC_ALL=C cut -d . -f 1`
de4157257515400c2c25373591135f110227b68cvboxsyncif [ ! -d "$DIR" ]; then
de4157257515400c2c25373591135f110227b68cvboxsync echo "Cannot find $DIR or it's not a directory..."
de4157257515400c2c25373591135f110227b68cvboxsyncif [ ! -d "$DEP_DIR" ]; then
de4157257515400c2c25373591135f110227b68cvboxsync echo "Cannot find $DEP_DIR or it's not a directory... (dependency)"
de4157257515400c2c25373591135f110227b68cvboxsyncif [ -n "$*" ]; then
de4157257515400c2c25373591135f110227b68cvboxsynctrap "sudo chown -R `whoami` $DIR $DEP_DIR; exit 1" INT
de4157257515400c2c25373591135f110227b68cvboxsync# Try unload any existing instance first.
de4157257515400c2c25373591135f110227b68cvboxsyncif test -n "$LOADED"; then
e5b6af682c9a5d58c91cb93278fbc76b42c2ff2avboxsync echo "${SCRIPT_NAME}.sh: Unloading $BUNDLE..."
de4157257515400c2c25373591135f110227b68cvboxsync if test -n "$LOADED"; then
e5b6af682c9a5d58c91cb93278fbc76b42c2ff2avboxsync echo "${SCRIPT_NAME}.sh: failed to unload $BUNDLE, see above..."
e5b6af682c9a5d58c91cb93278fbc76b42c2ff2avboxsync echo "${SCRIPT_NAME}.sh: Successfully unloaded $BUNDLE"
de4157257515400c2c25373591135f110227b68cvboxsync# Copy the .kext to the symbols directory and tweak the kextload options.
de4157257515400c2c25373591135f110227b68cvboxsyncif test -n "$VBOX_DARWIN_SYMS"; then
e5b6af682c9a5d58c91cb93278fbc76b42c2ff2avboxsync echo "${SCRIPT_NAME}.sh: copying the extension the symbol area..."
de4157257515400c2c25373591135f110227b68cvboxsync# On smbfs, this might succeed just fine but make no actual changes,
de4157257515400c2c25373591135f110227b68cvboxsync# so we might have to temporarily copy the driver to a local directory.
e5b6af682c9a5d58c91cb93278fbc76b42c2ff2avboxsync echo "${SCRIPT_NAME}.sh: chown didn't work on $DIR, using temp location $TMP_DIR/$DRVNAME"
de4157257515400c2c25373591135f110227b68cvboxsync # clean up first (no sudo rm)
de4157257515400c2c25373591135f110227b68cvboxsync if test -e "$TMP_DIR"; then
de4157257515400c2c25373591135f110227b68cvboxsync # make a copy and switch over DIR
de4157257515400c2c25373591135f110227b68cvboxsync # load.sh puts it here.
8bbe73936f792319b5206bec5170ac1e2cbd35d7vboxsync echo "${SCRIPT_NAME}.sh: loading $DIR... (kextutil $OPTS -d \"$DEP_DIR\" \"$DIR\")"