VirtualBox

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

最後變更 在這個檔案從2723是 2530,由 vboxsync 提交於 18 年 前

Updated the Linux installer init scripts to work with unknown distributions

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette