blob: f28b3a1cafe72df4101f9f54a41ea322c8e2ff10 (
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
|
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/vmware-workstation-tools/files/vmware-workstation-tools.rc,v 1.5 2007/04/28 10:08:45 ikelos Exp $
depend() {
before checkfs net
}
vmware_prettify() {
# Yea, the code is ugly but the output is pretty
state=$1
waserror=0
msgtype=0
while read line
do
[[ "${line}" == "" ]] && continue
if [[ "${msgtype}" -le "0" ]]
then
if [[ "${msgtype}" == "-1" ]]
then
ewarn ${line}
continue
fi
if [ "${line/*:*/}" == "" ]
then
einfon ${line}
echo
eend 0
msgtype=1
else
ewarn ${line}
msgtype=-1
waserror=1
fi
continue
fi
# Strip out anything after the <esc> code
message=`echo ${line} | sed -e "s/^\(.*\).*$/\1/"`
einfon " ${message}"
echo
echo ${line} | grep done > /dev/null
status=$?
eend ${status}
if [[ "${status}" != "0" ]]
then
logger -p local0.err -t vmware-${state} "${line}"
waserror=${status}
fi
done
if [[ "${msgtype}" == "-1" ]]
then
eend 1 "VMware is not properly configured! See above."
fi
return ${waserror}
}
start() {
test -x /etc/vmware-tools/init.d/vmware-tools || \
eend 1 "vmware init script not found. Aborting" || return 1
/etc/vmware-tools/init.d/vmware-tools start | vmware_prettify start
return $?
}
stop() {
/etc/vmware-tools/init.d/vmware-tools stop | vmware_prettify stop
return $?
}
|