VirtualBox

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

Last change on this file since 438 was 352, checked in by vboxsync, 18 years ago

Linux installer tidy-ups

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