VirtualBox

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

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

The Giant CDDL Dual-License Header Change.

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