aboutsummaryrefslogtreecommitdiffstats
path: root/community/open-vm-tools/open-vm-tools.initd
blob: 934ab0edc54d7781231b92c3e6d6692e41fb8b9e (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
#!/sbin/openrc-run

: ${vm_drag_and_drop:="no"}

command="/usr/bin/vmtoolsd"
command_background="yes"
pidfile="/run/vmtoolsd.pid"
# To not complain about missing messages...
start_stop_daemon_args="--env LANG=en_US.UTF-8"

depend() {
	before net X
}

start_pre() {
	[ "$vm_drag_and_drop" != yes ] || start_vmblock
}

stop_post() {
	[ "$vm_drag_and_drop" != yes ] || stop_vmblock || true
}

start_vmblock() {
	if ! [ -x /usr/bin/vmware-vmblock-fuse ]; then
		eerror "you have to install open-vm-tools-gtk to enable drag'n'drop!"
		return 1
	fi

	modprobe fuse > /dev/null 2>&1

	checkpath -d -m 1777 /tmp/VMwareDnD
	checkpath -d /run/vmblock-fuse

	ebegin "Mounting vmblock-fuse"
	vmware-vmblock-fuse \
		-o subtype=vmware-vmblock,default_permissions,allow_other \
		/run/vmblock-fuse
	eend $?
}

stop_vmblock() {
	if mount | grep -qw /run/vmblock-fuse; then
		ebegin "Unmounting vmblock-fuse"
		umount /run/vmblock-fuse
		eend $?
	fi
}