VirtualBox

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

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

Export attribs for Additions/solaris.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1#!/bin/bash
2# innotek VirtualBox
3# VirtualBox Guest Additions kernel module control script for Solaris.
4#
5# Copyright (C) 2007 innotek GmbH
6#
7# innotek GmbH confidential
8# All rights reserved
9#
10
11VBOXGUESTFILE=""
12SILENTUNLOAD=""
13
14abort()
15{
16 echo 1>&2 "$1"
17 exit 1
18}
19
20info()
21{
22 echo 1>&2 "$1"
23}
24
25get_module_path()
26{
27 cputype=`isainfo -k`
28 moduledir="/platform/i86pc/kernel/drv";
29 if test "$cputype" = "amd64"; then
30 moduledir=$moduledir/amd64
31 fi
32 modulepath=$moduledir/vboxguest
33 if test -f "$modulepath"; then
34 VBOXGUESTFILE="$modulepath"
35 else
36 VBOXGUESTFILE=""
37 fi
38}
39
40check_if_installed()
41{
42 if test "$VBOXGUESTFILE" -a -f "$VBOXGUESTFILE"; then
43 return 0
44 fi
45 abort "VirtualBox kernel module (vboxguest) not installed."
46}
47
48module_loaded()
49{
50 loadentry=`cat /etc/name_to_major | grep vboxguest`
51 if test -z "$loadentry"; then
52 return 1
53 fi
54 return 0
55}
56
57check_root()
58{
59 if test `id -u` -ne 0; then
60 abort "This program must be run with administrator privileges. Aborting"
61 fi
62}
63
64start()
65{
66 if module_loaded; then
67 info "vboxguest already loaded..."
68 else
69 /usr/sbin/add_drv -i'pci80ee,cafe' -m'* 0666 root sys' vboxguest
70 if ! module_loaded; then
71 abort "Failed to load vboxguest."
72 elif test -c "/devices/pci@0,0/pci80ee,cafe@4:vboxguest"; then
73 info "Loaded vboxguest."
74 else
75 stop
76 abort "Aborting due to attach failure."
77 fi
78 fi
79}
80
81stop()
82{
83 if module_loaded; then
84 /usr/sbin/rem_drv vboxguest
85 info "Unloaded vboxguest."
86 elif test -z "$SILENTUNLOAD"; then
87 info "vboxguest not loaded."
88 fi
89}
90
91restart()
92{
93 stop
94 sync
95 start
96 return 0
97}
98
99status()
100{
101 if module_loaded; then
102 info "vboxguest running."
103 else
104 info "vboxguest stopped."
105 fi
106}
107
108check_root
109get_module_path
110check_if_installed
111
112if test "$2" = "silentunload"; then
113 SILENTUNLOAD="$2"
114fi
115
116case "$1" in
117start)
118 start
119 ;;
120stop)
121 stop
122 ;;
123restart)
124 restart
125 ;;
126status)
127 status
128 ;;
129*)
130 echo "Usage: $0 {start|stop|restart|status}"
131 exit 1
132esac
133
134exit
135
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