summaryrefslogtreecommitdiff
blob: 4b3721d1bd67ab9f69db68ade9ba11ebdc9153c4 (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
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header:

depend() {
        need localmount
	before xdm
}

start() {
	ebegin "Starting VirtualBox guest additions"

	# Check if vboxadd and vboxvfs module are already loaded
	if [[ -e /proc/modules && ! -e /dev/vboxadd ]] ; then
                einfo "	Loading kernel modules and creating devices"
                /sbin/modprobe vboxadd &> /dev/null
		mknod /dev/vboxadd c 254 0 -m 0664 &> /dev/null
                /sbin/modprobe vboxvfs &> /dev/null
        fi

	einfo "	Starting the time syncronization system service"
        start-stop-daemon --start --make-pidfile \
		--exec /usr/sbin/vboxadd-timesync --pidfile /var/run/vboxadd-timesync.pid \
		--name vboxadd-timesync \
		--background

        eend $? "Failed to start VirtualBox guest additions"
}

stop() {
        ebegin "Stopping VirtualBox guest additions"

	einfo "	Stopping the time syncronization system service"
	start-stop-daemon --stop --quiet \
		--pidfile /var/run/vboxadd-timesync.pid --name vboxadd-timesync

	einfo " Unloading kernel modules and removing devices"
	/sbin/rmmod vboxvfs &> /dev/null
	/sbin/rmmod vboxadd &> /dev/null
	rm -f /dev/vboxadd &> /dev/null
        eend $?
}