loadnetflt.sh revision d65680efa46fa49e8bf14e67b29b782510ff934c
de4157257515400c2c25373591135f110227b68cvboxsync# For development.
de4157257515400c2c25373591135f110227b68cvboxsync# Copyright (C) 2006-2007 Sun Microsystems, Inc.
d65680efa46fa49e8bf14e67b29b782510ff934cvboxsync# Sun Microsystems, Inc. confidential
d65680efa46fa49e8bf14e67b29b782510ff934cvboxsync# All rights reserved
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\")"