loadnetflt.sh revision de4157257515400c2c25373591135f110227b68c
de4157257515400c2c25373591135f110227b68cvboxsync# For development.
de4157257515400c2c25373591135f110227b68cvboxsync# Copyright (C) 2006-2007 Sun Microsystems, Inc.
de4157257515400c2c25373591135f110227b68cvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
de4157257515400c2c25373591135f110227b68cvboxsync# available from http://www.virtualbox.org. This file is free software;
de4157257515400c2c25373591135f110227b68cvboxsync# you can redistribute it and/or modify it under the terms of the GNU
de4157257515400c2c25373591135f110227b68cvboxsync# General Public License (GPL) as published by the Free Software
de4157257515400c2c25373591135f110227b68cvboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
de4157257515400c2c25373591135f110227b68cvboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
de4157257515400c2c25373591135f110227b68cvboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
de4157257515400c2c25373591135f110227b68cvboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
de4157257515400c2c25373591135f110227b68cvboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
de4157257515400c2c25373591135f110227b68cvboxsync# additional information or have any questions.
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
de4157257515400c2c25373591135f110227b68cvboxsync echo "loadnetflt.sh: Unloading $BUNDLE..."
de4157257515400c2c25373591135f110227b68cvboxsync if test -n "$LOADED"; then
de4157257515400c2c25373591135f110227b68cvboxsync echo "loadnetflt: failed to unload $BUNDLE, see above..."
de4157257515400c2c25373591135f110227b68cvboxsync echo "loadnetflt: Successfully unloaded $BUNDLE"
de4157257515400c2c25373591135f110227b68cvboxsync# Copy the .kext to the symbols directory and tweak the kextload options.
de4157257515400c2c25373591135f110227b68cvboxsyncif test -n "$VBOX_DARWIN_SYMS"; then
de4157257515400c2c25373591135f110227b68cvboxsync echo "loadnetflt.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.
de4157257515400c2c25373591135f110227b68cvboxsync echo "loadnetflt.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.
de4157257515400c2c25373591135f110227b68cvboxsyncecho "loadnetflt: loading $DIR... (kextload $OPTS \"$DIR\")"