VirtualBox

source: vbox/trunk/src/VBox/Additions/solaris/Installer/vboxguest.sh@ 8177

Last change on this file since 8177 was 8177, checked in by vboxsync, 17 years ago

Rebranding

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1#!/bin/sh
2# Sun xVM VirtualBox
3# VirtualBox Guest Additions kernel module control script for Solaris.
4#
5# Copyright (C) 2008 Sun Microsystems, Inc.
6#
7# This file is part of VirtualBox Open Source Edition (OSE), as
8# available from http://www.virtualbox.org. This file is free software;
9# you can redistribute it and/or modify it under the terms of the GNU
10# General Public License (GPL) as published by the Free Software
11# Foundation, in version 2 as it comes in the "COPYING" file of the
12# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14#
15# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
16# Clara, CA 95054 USA or visit http://www.sun.com if you need
17# additional information or have any questions.
18#
19
20VBOXGUESTFILE=""
21SILENTUNLOAD=""
22
23abort()
24{
25 echo 1>&2 "$1"
26 exit 1
27}
28
29info()
30{
31 echo 1>&2 "$1"
32}
33
34get_module_path()
35{
36 cputype=`isainfo -k`
37 moduledir="/platform/i86pc/kernel/drv";
38 if test "$cputype" = "amd64"; then
39 moduledir=$moduledir/amd64
40 fi
41 modulepath=$moduledir/vboxguest
42 if test -f "$modulepath"; then
43 VBOXGUESTFILE="$modulepath"
44 else
45 VBOXGUESTFILE=""
46 fi
47}
48
49check_if_installed()
50{
51 if test "$VBOXGUESTFILE" -a -f "$VBOXGUESTFILE"; then
52 return 0
53 fi
54 abort "VirtualBox kernel module (vboxguest) not installed."
55}
56
57module_loaded()
58{
59 loadentry=`cat /etc/name_to_major | grep vboxguest`
60 if test -z "$loadentry"; then
61 return 1
62 fi
63 return 0
64}
65
66check_root()
67{
68 if test `/usr/xpg4/bin/id -u` -ne 0; then
69 abort "This program must be run with administrator privileges. Aborting"
70 fi
71}
72
73start_module()
74{
75 if module_loaded; then
76 info "vboxguest already loaded..."
77 else
78 /usr/sbin/add_drv -i'pci80ee,cafe' -m'* 0666 root sys' vboxguest
79 if test ! module_loaded; then
80 abort "Failed to load vboxguest."
81 elif test -c "/devices/pci@0,0/pci80ee,cafe@4:vboxguest"; then
82 info "Loaded vboxguest."
83 else
84 stop
85 abort "Aborting due to attach failure."
86 fi
87 fi
88}
89
90stop_module()
91{
92 if module_loaded; then
93 /usr/sbin/rem_drv vboxguest
94 info "Unloaded vboxguest."
95 elif test -z "$SILENTUNLOAD"; then
96 info "vboxguest not loaded."
97 fi
98}
99
100restart_module()
101{
102 stop_module
103 sync
104 start_module
105 return 0
106}
107
108status_module()
109{
110 if module_loaded; then
111 info "vboxguest running."
112 else
113 info "vboxguest stopped."
114 fi
115}
116
117check_root
118get_module_path
119check_if_installed
120
121if test "$2" = "silentunload"; then
122 SILENTUNLOAD="$2"
123fi
124
125case "$1" in
126start)
127 start_module
128 ;;
129stop)
130 stop_module
131 ;;
132restart)
133 restart_module
134 ;;
135status)
136 status_module
137 ;;
138*)
139 echo "Usage: $0 {start|stop|restart|status}"
140 exit 1
141esac
142
143exit
144
Note: See TracBrowser for help on using the repository browser.

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