VirtualBox

Changeset 8092 in vbox


Ignore:
Timestamp:
Apr 17, 2008 12:33:33 PM (17 years ago)
Author:
vboxsync
Message:

unload and smbfs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/darwin/load.sh

    r7193 r8092  
    11#!/bin/bash
     2## @file
     3# For development.
     4#
    25
    3 #
    4 # For development.
    56#
    67# Copyright (C) 2006-2007 innotek GmbH
     
    2425#
    2526
     27DRVNAME="VBoxDrv.kext"
     28BUNDLE="org.virtualbox.kext.VBoxDrv"
    2629
    27 DIR="VBoxDrv.kext"
    28 
     30DIR=`dirname "$0"`
     31DIR=`cd "$DIR" && pwd`
     32DIR="$DIR/$DRVNAME"
    2933if [ ! -d "$DIR" ]; then
    3034    echo "Cannot find $DIR or it's not a directory..."
     
    3842
    3943trap "sudo chown -R `whoami` $DIR; exit 1" INT
    40 set -x
     44
     45# Try unload any existing instance first.
     46LOADED=`kextstat -b $BUNDLE -l`
     47if test -n "$LOADED"; then
     48    echo "load.sh: Unloading $BUNDLE..."
     49    sudo kextunload -v 6 -b $BUNDLE
     50    LOADED=`kextstat -b $BUNDLE -l`
     51    if test -n "$LOADED"; then
     52        echo "load.sh: failed to unload $BUNDLE, see above..."
     53        exit 1;
     54    fi
     55    echo "load.sh: Successfully unloaded $BUNDLE"
     56fi
     57
     58set -e
     59# On smbfs, this might succeed just fine but make no actual changes,
     60# so we might have to temporarily copy the driver to a local directory.
    4161sudo chown -R root:wheel "$DIR"
     62OWNER=`stat -f "%u" "$DIR"`
     63if test "$OWNER" -ne 0; then
     64    TMP_DIR=/tmp/loaddrv.tmp
     65    echo "load.sh: chown didn't work on $DIR, using temp location $TMP_DIR/$DRVNAME"
     66
     67    # clean up first (no sudo rm)
     68    if test -e "$TMP_DIR"; then
     69        sudo chown -R `whoami` "$TMP_DIR"
     70        rm -Rf "$TMP_DIR"
     71    fi
     72
     73    # make a copy and switch over DIR
     74    mkdir -p "$TMP_DIR/"
     75    cp -Rp "$DIR" "$TMP_DIR/"
     76    DIR="$TMP_DIR/$DRVNAME"
     77
     78    # retry
     79    sudo chown -R root:wheel "$DIR"
     80fi
    4281sudo chmod -R o-rwx "$DIR"
    4382sync
     83echo "load.sh: loading $DIR..."
    4484sudo kextload $OPTS "$DIR"
     85sync
    4586sudo chown -R `whoami` "$DIR"
    46 sudo chmod 666 /dev/vboxdrv
     87#sudo chmod 666 /dev/vboxdrv
     88kextstat | grep org.virtualbox.kext
     89
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette