1 |
floppym 13/10/31 20:07:13 |
2 |
|
3 |
Modified: open-vm-tools.initd |
4 |
Log: |
5 |
Rewrite init script, bug 489252. |
6 |
|
7 |
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4) |
8 |
|
9 |
Revision Changes Path |
10 |
1.4 app-emulation/open-vm-tools/files/open-vm-tools.initd |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/open-vm-tools/files/open-vm-tools.initd?rev=1.4&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/open-vm-tools/files/open-vm-tools.initd?rev=1.4&content-type=text/plain |
14 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/open-vm-tools/files/open-vm-tools.initd?r1=1.3&r2=1.4 |
15 |
|
16 |
Index: open-vm-tools.initd |
17 |
=================================================================== |
18 |
RCS file: /var/cvsroot/gentoo-x86/app-emulation/open-vm-tools/files/open-vm-tools.initd,v |
19 |
retrieving revision 1.3 |
20 |
retrieving revision 1.4 |
21 |
diff -u -r1.3 -r1.4 |
22 |
--- open-vm-tools.initd 17 Jul 2011 13:23:00 -0000 1.3 |
23 |
+++ open-vm-tools.initd 31 Oct 2013 20:07:13 -0000 1.4 |
24 |
@@ -1,76 +1,60 @@ |
25 |
#!/sbin/runscript |
26 |
-# Copyright 1999-2011 Gentoo Foundation |
27 |
+# Copyright 1999-2013 Gentoo Foundation |
28 |
# Distributed under the terms of the GNU General Public License v2 |
29 |
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/open-vm-tools/files/open-vm-tools.initd,v 1.3 2011/07/17 13:23:00 vadimk Exp $ |
30 |
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/open-vm-tools/files/open-vm-tools.initd,v 1.4 2013/10/31 20:07:13 floppym Exp $ |
31 |
|
32 |
-DND_TMPDIR="/tmp/VMwareDnD" |
33 |
-USER_GROUP="root:vmware" |
34 |
-DND_TMPDIR_PERMS="1777" |
35 |
-GUESTD_BIN="/usr/bin/vmtoolsd" |
36 |
-PIDFILE="/var/run/vmtoolsd.pid" |
37 |
-MOUNTPOINT="/proc/fs/vmblock/mountPoint" |
38 |
+pidfile="/run/vmtoolsd.pid" |
39 |
+command="/usr/bin/vmtoolsd" |
40 |
+command_args="-b ${pidfile}" |
41 |
+ |
42 |
+vmblockmntpt="/proc/fs/vmblock/mountPoint" |
43 |
+vmblockfusemntpt="/run/vmblock-fuse" |
44 |
|
45 |
depend() { |
46 |
before checkfs fsck net X |
47 |
} |
48 |
|
49 |
-start() { |
50 |
- if [ "${VM_DRAG_AND_DROP}" == "yes" ]; |
51 |
- then |
52 |
- |
53 |
- if ! grep -q -w vmblock /proc/modules; |
54 |
- then |
55 |
- ebegin "Loading vmblock module" |
56 |
- modprobe vmblock |
57 |
- eend $? |
58 |
- sleep 0.25 |
59 |
- fi |
60 |
- |
61 |
- if [[ ! -d "${DND_TMPDIR}" ]]; |
62 |
- then |
63 |
- # einfo "Creating the VM drag and drop directory" |
64 |
- mkdir "${DND_TMPDIR}" |
65 |
- chown "${USER_GROUP}" "${DND_TMPDIR}" |
66 |
- chmod "${DND_TMPDIR_PERMS}" "${DND_TMPDIR}" |
67 |
- fi |
68 |
- |
69 |
- # DnD_TMPDIR must exist before vmblock can be mounted |
70 |
- ebegin "Mounting vmblock device" |
71 |
- mount -t vmblock none ${MOUNTPOINT} |
72 |
+start_vmblock() { |
73 |
+ checkpath -d -m 1777 /tmp/VMwareDnD |
74 |
+ if command -v vmware-vmblock-fuse > /dev/null; then |
75 |
+ modprobe fuse > /dev/null 2>&1 |
76 |
+ checkpath -d "${vmblockfusemntpt}" |
77 |
+ ebegin "Mounting vmblock-fuse" |
78 |
+ vmware-vmblock-fuse \ |
79 |
+ -o subtype=vmware-vmblock,default_permissions,allow_other \ |
80 |
+ "${vmblockfusemntpt}" |
81 |
+ eend $? |
82 |
+ else |
83 |
+ modprobe vmblock > /dev/null 2>&1 |
84 |
+ checkpath -d "${vmblockmntpt}" |
85 |
+ ebegin "Mounting vmblock" |
86 |
+ mount -t vmblock vmblock "${vmblockmntpt}" |
87 |
eend $? |
88 |
fi |
89 |
- |
90 |
- ebegin "Starting vmtoolsd" |
91 |
- start-stop-daemon --user "${USER_GROUP}" --start --quiet --background --make-pidfile --pidfile "${PIDFILE}" --exec ${GUESTD_BIN} |
92 |
- eend $? |
93 |
} |
94 |
|
95 |
-stop() { |
96 |
- local ret |
97 |
- |
98 |
- if [ "${VM_DRAG_AND_DROP}" == "yes" ]; |
99 |
- then |
100 |
- ebegin "Cleaning the contents of ${DND_TMPDIR}" |
101 |
- # First check, whether ${DND_TMPDIR} isn valid... we shouldn't risk deleting the content of ""/* |
102 |
- if [[ ! -z "${DND_TMPDIR}" ]] && [[ "${DND_TMPDIR}" != "/" ]]; |
103 |
- then |
104 |
- rm -rf ${DND_TMPDIR}/* |
105 |
- ret=0 |
106 |
- else |
107 |
- eerror "Not cleaning up ${DND_TMPDIR}, please check definition of variable" |
108 |
- ret=1 |
109 |
- fi |
110 |
- eend $ret |
111 |
- |
112 |
- ebegin "Unmounting vmblock device" |
113 |
- if grep -q -w "${MOUNTPOINT}" /proc/mounts; |
114 |
- then |
115 |
- umount ${MOUNTPOINT} 1>&2 > /dev/null |
116 |
- fi |
117 |
- eend 0 |
118 |
+stop_vmblock() { |
119 |
+ if [ -d "${vmblockfusemntpt}" ]; then |
120 |
+ ebegin "Unmounting vmblock-fuse" |
121 |
+ umount "${vmblockfusemntpt}" |
122 |
+ eend $? |
123 |
+ else |
124 |
+ ebegin "Unmounting vmblock" |
125 |
+ umount "${vmblockmntpt}" |
126 |
+ eend $? |
127 |
fi |
128 |
+} |
129 |
|
130 |
- ebegin "Stopping vmtoolsd" |
131 |
- start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" |
132 |
- eend $? |
133 |
+start_pre() { |
134 |
+ if [ x"${VM_DRAG_AND_DROP}" = xyes ]; then |
135 |
+ start_vmblock |
136 |
+ fi |
137 |
+ return 0 |
138 |
+} |
139 |
+ |
140 |
+stop_post() { |
141 |
+ if [ x"${VM_DRAG_AND_DROP}" = xyes ]; then |
142 |
+ stop_vmblock |
143 |
+ fi |
144 |
+ return 0 |
145 |
} |