blob: 555fa1535e42f9111a80153467a0916ef9eb6b18 (
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
# source application-specific settings
[ -f /etc/conf.d/open-vm-tools ] && . /etc/conf.d/open-vm-tools
PID=`pidof -o %PPID /usr/bin/vmtoolsd`
case "$1" in
start)
stat_busy "Starting Open Virtual Machine Tools"
if [ "$VM_DRAG_AND_DROP" == "yes" ]; then
VMBLOCK=`grep -w vmblock /proc/modules`
[ -z "$VMBLOCK" ] && modprobe -f vmblock
if [ $? -gt 0 ]; then
stat_fail
exit 1
fi
DND_TMPDIR="/tmp/VMwareDnD"
if [ ! -d "$DND_TMPDIR" ]; then
mkdir $DND_TMPDIR
chmod 1777 $DND_TMPDIR
fi
mount -t vmblock none /proc/fs/vmblock/mountPoint
if [ $? -gt 0 ]; then
stat_fail
exit 1
fi
fi
for m in vmhgfs vmsync; do
VMMOD=`grep -w $m /proc/modules`
[ -z "$VMMOD" ] && \
{ modprobe -f $m
if [ $? -gt 0 ]; then
stat_fail
exit 1
fi; }
done
[ -z "$PID" ] && /usr/bin/vmtoolsd --background $PIDFILE
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon open-vm-tools
stat_done
fi
;;
stop)
stat_busy "Stopping Open Virtual Machine Tools"
[ ! -z "$PID" ] && kill $PID &>/dev/null
# if [ $? -gt 0 ]; then
# stat_fail
# exit 1
# fi
for m in vmhgfs vmsync vmci; do
VMMOD=`grep -w $m /proc/modules`
[ ! -z "$VMMOD" ] && rmmod $m
if [ $? -gt 0 ]; then
stat_fail
exit 4
fi
done
if [ "$VM_DRAG_AND_DROP" == "yes" ]; then
MOUNTPOINT=`grep -w "none /proc/fs/vmblock/mountPoint vmblock" /proc/modules`
[ -z "$MOUNTPOINT" ] && umount /proc/fs/vmblock/mountPoint
if [ $? -gt 0 ]; then
stat_fail
exit 5
fi
DND_TMPDIR="/tmp/VMwareDnD"
rm -r $DND_TMPDIR
VMBLOCK=`grep -w vmblock /proc/modules`
[ ! -z "$VMBLOCK" ] && rmmod vmblock
if [ $? -gt 0 ]; then
stat_fail
exit 6
fi
fi
rm_daemon open-vm-tools
stat_done
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
|