summarylogtreecommitdiffstats
path: root/vmware.initd
blob: ac46f8a10d7a5e3a6ed8894dd98873df224a90a7 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need localmount
	use net
}

start() {
	#start-stop-daemon --start --exec @@BINDIR@@/vmware-usbarbitrator
	/usr/bin/vmware-usbarbitrator 
	
	# vmci might be:
	# 1) built as external kernel module
	# 2) built as internal kernel module (with name vmw_vmci)
	# 3) embedded in the kernel
	for mod in /lib/modules/$(uname -r)/misc/vmci.ko \
		/lib/modules/$(uname -r)/kernel/drivers/misc/vmw_vmci/vmw_vmci.ko ;
	do
		if [[ -f "${mod}" ]] ; then
			modprobe -v $(basename "${mod}" .ko)
			eend $?
			break
		fi
	done
	
	# vsock might be:
	# 1) built as external kernel module
	# 2) built as internal kernel module (with name vmw_vsock_vmci_transport)
	# 3) embedded in the kernel
	for mod in /lib/modules/$(uname -r)/misc/vsock.ko \
		/lib/modules/$(uname -r)/kernel/net/vmw_vsock/vmw_vsock_vmci_transport.ko ;
	do
		if [[ -f "${mod}" ]] ; then
			modprobe -v $(basename "${mod}" .ko)
			eend $?
			break
		fi
	done

	# vmci or vsock were already loaded by the previous modprobe,
	# no need to do it here
	modprobe -av vmmon vmnet 
	/usr/bin/vmware-networks --start
}

stop() {
	#start-stop-daemon --stop --exec @@BINDIR@@/vmware-usbarbitrator
	killall --wait /usr/bin/vmware-usbarbitrator 
	eend $?
	/usr/bin/vmware-networks --stop 
	eend $?
	ebegin Stopping VMware services
	modprobe -rv vmmon vmnet
	
	# vsock might be:
	# 1) built as external kernel module
	# 2) built as internal kernel module (with name vmw_vsock_vmci_transport)
	# 3) embedded in the kernel
	for mod in /lib/modules/$(uname -r)/misc/vsock.ko \
		/lib/modules/$(uname -r)/kernel/net/vmw_vsock/vmw_vsock_vmci_transport.ko ;
	do
		if [[ -f "${mod}" ]] ; then
			modprobe -rv $(basename "${mod}" .ko)
			eend $?
			break
		fi
	done

	# vmci might be:
	# 1) built as external kernel module
	# 2) built as internal kernel module (with name vmw_vmci)
	# 3) embedded in the kernel
	for mod in /lib/modules/$(uname -r)/misc/vmci.ko \
		/lib/modules/$(uname -r)/kernel/drivers/misc/vmw_vmci/vmw_vmci.ko ;
	do
		if [[ -f "${mod}" ]] ; then
			modprobe -rv $(basename "${mod}" .ko)
			eend $?
			break
		fi
	done
}