VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/darwin/load.sh@ 8114

最後變更 在這個檔案從8114是 8102,由 vboxsync 提交於 17 年 前

Unload VBoxUSB.kext before reloading VBoxDrv.kext.

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:executable 設為 *
  • 屬性 svn:keywords 設為 Id
檔案大小: 3.0 KB
 
1#!/bin/bash
2## @file
3# For development.
4#
5
6#
7# Copyright (C) 2006-2007 innotek GmbH
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.alldomusa.eu.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# The contents of this file may alternatively be used under the terms
18# of the Common Development and Distribution License Version 1.0
19# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20# VirtualBox OSE distribution, in which case the provisions of the
21# CDDL are applicable instead of those of the GPL.
22#
23# You may elect to license modified versions of this file under the
24# terms and conditions of either the GPL or the CDDL or both.
25#
26
27DRVNAME="VBoxDrv.kext"
28BUNDLE="org.virtualbox.kext.VBoxDrv"
29
30DIR=`dirname "$0"`
31DIR=`cd "$DIR" && pwd`
32DIR="$DIR/$DRVNAME"
33if [ ! -d "$DIR" ]; then
34 echo "Cannot find $DIR or it's not a directory..."
35 exit 1;
36fi
37if [ -n "$*" ]; then
38 OPTS="$*"
39else
40 OPTS="-t"
41fi
42
43# Make sure VBoxUSB is unloaded as it might be using symbols from us.
44LOADED=`kextstat -b org.virtualbox.kext.VBoxUSB -l`
45if test -n "$LOADED"; then
46 echo "load.sh: Unloading org.virtualbox.kext.VBoxUSB..."
47 sudo kextunload -v 6 -b org.virtualbox.kext.VBoxUSB
48 LOADED=`kextstat -b org.virtualbox.kext.VBoxUSB -l`
49 if test -n "$LOADED"; then
50 echo "load.sh: failed to unload org.virtualbox.kext.VBoxUSB, see above..."
51 exit 1;
52 fi
53 echo "load.sh: Successfully unloaded org.virtualbox.kext.VBoxUSB"
54fi
55
56# Try unload any existing instance first.
57LOADED=`kextstat -b $BUNDLE -l`
58if test -n "$LOADED"; then
59 echo "load.sh: Unloading $BUNDLE..."
60 sudo kextunload -v 6 -b $BUNDLE
61 LOADED=`kextstat -b $BUNDLE -l`
62 if test -n "$LOADED"; then
63 echo "load.sh: failed to unload $BUNDLE, see above..."
64 exit 1;
65 fi
66 echo "load.sh: Successfully unloaded $BUNDLE"
67fi
68
69set -e
70trap "sudo chown -R `whoami` $DIR; exit 1" INT
71# On smbfs, this might succeed just fine but make no actual changes,
72# so we might have to temporarily copy the driver to a local directory.
73sudo chown -R root:wheel "$DIR"
74OWNER=`stat -f "%u" "$DIR"`
75if test "$OWNER" -ne 0; then
76 TMP_DIR=/tmp/loaddrv.tmp
77 echo "load.sh: chown didn't work on $DIR, using temp location $TMP_DIR/$DRVNAME"
78
79 # clean up first (no sudo rm)
80 if test -e "$TMP_DIR"; then
81 sudo chown -R `whoami` "$TMP_DIR"
82 rm -Rf "$TMP_DIR"
83 fi
84
85 # make a copy and switch over DIR
86 mkdir -p "$TMP_DIR/"
87 cp -Rp "$DIR" "$TMP_DIR/"
88 DIR="$TMP_DIR/$DRVNAME"
89
90 # retry
91 sudo chown -R root:wheel "$DIR"
92fi
93sudo chmod -R o-rwx "$DIR"
94sync
95echo "load.sh: loading $DIR..."
96sudo kextload $OPTS "$DIR"
97sync
98sudo chown -R `whoami` "$DIR"
99#sudo chmod 666 /dev/vboxdrv
100kextstat | grep org.virtualbox.kext
101
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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