VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/installer/vboxvfs.sh@ 1284

Last change on this file since 1284 was 495, checked in by vboxsync, 18 years ago

Additions installers are not OSE

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1#! /bin/sh
2# InnoTek VirtualBox
3# Linux Additions VFS kernel module init script
4#
5# Copyright (C) 2006 InnoTek Systemberatung GmbH
6#
7# Use only with permission.
8#
9
10
11# chkconfig: 35 30 60
12# description: VirtualBox Linux Additions VFS kernel module
13#
14### BEGIN INIT INFO
15# Provides: vboxvfs
16# Required-Start: $syslog vboxadd
17# Required-Stop:
18# Default-Start: 3 5
19# Default-Stop:
20# Description: VirtualBox Linux Additions VFS kernel module
21### END INIT INFO
22
23PATH=$PATH:/bin:/sbin:/usr/sbin
24
25system=unknown
26if [ -f /etc/redhat-release ]; then
27 system=redhat
28elif [ -f /etc/SuSE-release ]; then
29 system=suse
30elif [ -f /etc/debian_version ]; then
31 system=debian
32elif [ -f /etc/gentoo-release ]; then
33 system=gentoo
34elif [ -f /etc/slackware-version ]; then
35 system=slackware
36else
37 echo "$0: Unknown system" 1>&2
38fi
39
40if [ "$system" = redhat ]; then
41 . /etc/init.d/functions
42 fail_msg() {
43 echo_failure
44 echo
45 }
46
47 succ_msg() {
48 echo_success
49 echo
50 }
51
52 begin() {
53 echo -n $1
54 }
55fi
56
57if [ "$system" = suse ]; then
58 . /etc/rc.status
59 fail_msg() {
60 rc_failed 1
61 rc_status -v
62 }
63
64 succ_msg() {
65 rc_reset
66 rc_status -v
67 }
68
69 begin() {
70 echo -n $1
71 }
72fi
73
74if [ "$system" = debian ]; then
75 fail_msg() {
76 echo " ...fail!"
77 }
78
79 succ_msg() {
80 echo " ...done."
81 }
82
83 begin() {
84 echo -n $1
85 }
86fi
87
88if [ "$system" = gentoo ]; then
89 . /sbin/functions.sh
90 fail_msg() {
91 eend 1
92 }
93
94 succ_msg() {
95 eend $?
96 }
97
98 begin() {
99 ebegin $1
100 }
101
102 if [ "`which $0`" = "/sbin/rc" ]; then
103 shift
104 fi
105fi
106
107if [ "$system" = slackware ]; then
108 fail_msg() {
109 echo " ...fail!"
110 }
111
112 succ_msg() {
113 echo " ...done."
114 }
115
116 begin() {
117 echo -n $1
118 }
119fi
120
121kdir=/lib/modules/`uname -r`/misc
122modname=vboxvfs
123module="$kdir/$modname"
124
125file=""
126test -f $module.o && file=$module.o
127test -f $module.ko && file=$module.ko
128
129fail() {
130 if [ "$system" = gentoo ]; then
131 eerror $1
132 exit 1
133 fi
134 fail_msg
135 echo "($1)"
136 exit 1
137}
138
139test -z "$file" && {
140 fail "Kernel module not found"
141}
142
143running() {
144 lsmod | grep -q $modname[^_-]
145}
146
147start() {
148 begin "Starting VirtualBox Additions shared folder support";
149 running || {
150 modprobe $modname > /dev/null 2>&1 || {
151 if dmesg | grep "vboxConnect failed" > /dev/null 2>&1; then
152 fail_msg
153 echo "You may be trying to run Guest Additions from binary release of VirtualBox"
154 echo "in the Open Source Edition."
155 exit 1
156 fi
157 fail "modprobe $modname failed"
158 }
159 }
160 succ_msg
161 return 0
162}
163
164stop() {
165 begin "Stopping VirtualBox Additions shared folder support";
166 if running; then
167 rmmod $modname || fail "Cannot unload module $modname"
168 fi
169 succ_msg
170 return 0
171}
172
173restart() {
174 stop && start
175 return 0
176}
177
178dmnstatus() {
179 if running; then
180 echo "VirtualBox Additions shared folder support is currently running."
181 else
182 echo "VirtualBox Additions shared folder support is not currently running."
183 fi
184}
185
186case "$1" in
187start)
188 start
189 ;;
190stop)
191 stop
192 ;;
193restart)
194 restart
195 ;;
196status)
197 dmnstatus
198 ;;
199*)
200 echo "Usage: $0 {start|stop|restart|status}"
201 exit 1
202esac
203
204exit
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