loadusb.sh revision c55c68b6a3324172e9dc207926215845880b0f90
59190ecd61435d19ba3515b876272aee7bd12298vboxsync# For development.
59190ecd61435d19ba3515b876272aee7bd12298vboxsync# Copyright (C) 2006-2010 Oracle Corporation
c55c68b6a3324172e9dc207926215845880b0f90vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
c55c68b6a3324172e9dc207926215845880b0f90vboxsync# available from http://www.virtualbox.org. This file is free software;
c55c68b6a3324172e9dc207926215845880b0f90vboxsync# you can redistribute it and/or modify it under the terms of the GNU
c55c68b6a3324172e9dc207926215845880b0f90vboxsync# General Public License (GPL) as published by the Free Software
c55c68b6a3324172e9dc207926215845880b0f90vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
c55c68b6a3324172e9dc207926215845880b0f90vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c55c68b6a3324172e9dc207926215845880b0f90vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncXNU_VERSION=`LC_ALL=C uname -r | LC_ALL=C cut -d . -f 1`
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncif [ ! -d "$DIR" ]; then
59190ecd61435d19ba3515b876272aee7bd12298vboxsync echo "Cannot find $DIR or it's not a directory..."
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncif [ ! -d "$DEP_DIR" ]; then
59190ecd61435d19ba3515b876272aee7bd12298vboxsync echo "Cannot find $DEP_DIR or it's not a directory... (dependency)"
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncif [ -n "$*" ]; then
59190ecd61435d19ba3515b876272aee7bd12298vboxsynctrap "sudo chown -R `whoami` $DIR $DEP_DIR; exit 1" INT
59190ecd61435d19ba3515b876272aee7bd12298vboxsync# Try unload any existing instance first.
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncif test -n "$LOADED"; then
59190ecd61435d19ba3515b876272aee7bd12298vboxsync echo "${SCRIPT_NAME}.sh: Unloading $BUNDLE..."
59190ecd61435d19ba3515b876272aee7bd12298vboxsync if test -n "$LOADED"; then
59190ecd61435d19ba3515b876272aee7bd12298vboxsync echo "${SCRIPT_NAME}.sh: failed to unload $BUNDLE, see above..."
59190ecd61435d19ba3515b876272aee7bd12298vboxsync echo "${SCRIPT_NAME}.sh: Successfully unloaded $BUNDLE"
59190ecd61435d19ba3515b876272aee7bd12298vboxsync# Copy the .kext to the symbols directory and tweak the kextload options.
59190ecd61435d19ba3515b876272aee7bd12298vboxsyncif test -n "$VBOX_DARWIN_SYMS"; then
59190ecd61435d19ba3515b876272aee7bd12298vboxsync echo "${SCRIPT_NAME}.sh: copying the extension the symbol area..."
59190ecd61435d19ba3515b876272aee7bd12298vboxsync# On smbfs, this might succeed just fine but make no actual changes,
59190ecd61435d19ba3515b876272aee7bd12298vboxsync# so we might have to temporarily copy the driver to a local directory.
59190ecd61435d19ba3515b876272aee7bd12298vboxsync echo "${SCRIPT_NAME}.sh: chown didn't work on $DIR, using temp location $TMP_DIR/$DRVNAME"
59190ecd61435d19ba3515b876272aee7bd12298vboxsync # clean up first (no sudo rm)
59190ecd61435d19ba3515b876272aee7bd12298vboxsync if test -e "$TMP_DIR"; then
59190ecd61435d19ba3515b876272aee7bd12298vboxsync # make a copy and switch over DIR
59190ecd61435d19ba3515b876272aee7bd12298vboxsync # load.sh puts it here.
59190ecd61435d19ba3515b876272aee7bd12298vboxsync echo "${SCRIPT_NAME}.sh: loading $DIR... (kextutil $OPTS -d \"$DEP_DIR\" \"$DIR\")"