VirtualBox

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

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

Changed to OSE copyright headers for Additions/solaris.

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