blob: 08f3ef8ebab7db4641cd5508798ea4bc0dfdcc1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: vboxguest
# REQUIRE: FILESYSTEMS
# BEFORE: netif
# KEYWORD: nojail
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# vboxguest_enable (bool): Set to NO by default.
# Set it to YES to enable vboxguest on startup
. /etc/rc.subr
name="vboxguest"
rcvar=vboxguest_enable
start_cmd="vboxguest_start"
stop_cmd="vboxguest_stop"
vboxguest_modules="vboxguest:pci/vboxguest"
vboxguest_start()
{
local _k _m
for _m in ${vboxguest_modules}; do
_k=${_m%:*}
_m=${_m#*:}
if ! kldstat -q -m ${_m}; then
if ! kldload ${_k} > /dev/null 2>&1; then
warn "Can't load ${_k} module."
return 1
fi
fi
done
}
vboxguest_stop()
{
local _k _m _r
_r=
for _m in ${vboxguest_modules}; do
_r="${_m} ${_r}"
done
for _m in ${_r}; do
_k=${_m%:*}
_m=${_m#*:}
if kldstat -q -m ${_m}; then
if ! kldunload ${_k} > /dev/null 2>&1; then
warn "Can't unload ${_k} module."
return 1
fi
fi
done
}
load_rc_config $name
: ${vboxguest_enable="NO"}
run_rc_command "$1"
|