VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/solaris/mod.sh@ 38791

Last change on this file since 38791 was 37314, checked in by vboxsync, 13 years ago

solaris/mod.sh: one sync is enough.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Id Revision
File size: 3.1 KB
Line 
1#!/bin/sh
2# $Id: mod.sh 37314 2011-06-03 09:23:02Z vboxsync $
3## @file
4# Helper script for installing the solaris module in a development environment.
5#
6
7#
8# Copyright (C) 2006-2011 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18# The contents of this file may alternatively be used under the terms
19# of the Common Development and Distribution License Version 1.0
20# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
21# VirtualBox OSE distribution, in which case the provisions of the
22# CDDL are applicable instead of those of the GPL.
23#
24# You may elect to license modified versions of this file under the
25# terms and conditions of either the GPL or the CDDL or both.
26#
27
28set -x
29#
30# Figure out the environment and locations.
31#
32
33# Sudo isn't native solaris, but it's very convenient...
34if test -z "$SUDO" && test "`whoami`" != "root"; then
35 SUDO=sudo
36fi
37
38script_dir=`dirname "$0"`
39# src/VBox/HostDrivers/solaris/ residence:
40script_dir=`cd "$script_dir/../../../../.." ; /bin/pwd`
41## root residence:
42#script_dir=`cd "$script_dir" ; /bin/pwd`
43
44set -e
45if test -z "$BUILD_TARGET"; then
46 export BUILD_TARGET=solaris
47fi
48if test -z "$BUILD_TARGET_ARCH"; then
49 export BUILD_TARGET_ARCH=x86
50fi
51if test -z "$BUILD_TYPE"; then
52 export BUILD_TYPE=debug
53fi
54
55DIR=$script_dir/out/$BUILD_TARGET.$BUILD_TARGET_ARCH/$BUILD_TYPE/bin/
56
57VBOXDRV_CONF_DIR=/platform/i86pc/kernel/drv
58if test "$BUILD_TARGET_ARCH" = "amd64"; then
59 VBOXDRV_DIR=$VBOXDRV_CONF_DIR/amd64
60else
61 VBOXDRV_DIR=$VBOXDRV_CONF_DIR
62fi
63
64#
65# Do the job.
66#
67$SUDO cp $DIR/vboxdrv $VBOXDRV_DIR/vboxdrv
68$SUDO cp $script_dir/src/VBox/HostDrivers/Support/solaris/vboxdrv.conf $VBOXDRV_CONF_DIR/vboxdrv.conf
69old_id=`/usr/sbin/modinfo | /usr/xpg4/bin/grep vbox | grep -v vboxguest | grep -v vboxfs | cut -f 1 -d ' ' | sort -n -r `
70if test -n "$old_id"; then
71 echo "* unloading $old_id..."
72 sync
73 $SUDO /usr/sbin/modunload -i $old_id
74#else
75# echo "* If it fails below, run: $SUDO add_drv -m'* 0666 root sys' vboxdrv"
76fi
77$SUDO /usr/sbin/rem_drv vboxdrv || echo "* ignored rem_drv failure..."
78$SUDO /usr/sbin/add_drv vboxdrv
79
80if /usr/xpg4/bin/grep -q vboxdrv /etc/devlink.tab; then
81 echo "* vboxdrv already present in /etc/devlink.tab"
82else
83 echo "* Adding vboxdrv to /etc/devlink.tab"
84 $SUDO rm -f /tmp/devlink.tab.vboxdrv
85 echo "" > /tmp/devlink.tab.vboxdrv
86 echo '# vbox' >> /tmp/devlink.tab.vboxdrv
87 echo 'type=ddi_pseudo;name=vboxdrv \D' >> /tmp/devlink.tab.vboxdrv
88 $SUDO /bin/sh -c 'cat /tmp/devlink.tab.vboxdrv >> /etc/devlink.tab'
89fi
90
91echo "* loading vboxdrv..."
92sync
93$SUDO /usr/sbin/modload $VBOXDRV_DIR/vboxdrv
94/usr/sbin/modinfo | /usr/xpg4/bin/grep vboxdrv
95echo "* dmesg:"
96dmesg | tail -20
97if test ! -h /dev/vboxdrv; then
98 $SUDO /usr/sbin/devfsadm -i vboxdrv
99fi
100ls -laL /dev/vboxdrv
Note: See TracBrowser for help on using the repository browser.

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