virtualization/app-emulation/vmware-server/files/vmware-server-2.rc
2009-12-24 15:39:51 +00:00

70 lines
1.5 KiB
Plaintext
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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-server/files/vmware-server-2.rc,v 1.1 2009/05/09 21:55:17 ikelos Exp $
depend() {
need localmount hald
use logger net
after samba
}
vmware_prettify() {
# Yea, the code is ugly but the output is pretty
state=$1
waserror=0
while read line
do
# Ignore blank lines
[ "${line}" = "" ] && continue
# Determine what kind of line it is to provide einfo or ewarn etc
case ${line} in
*Starting\ *)
einfo ${line};;
*Stopping\ *)
einfo ${line};;
*VMware\ Virtual\ Infrastructure\ Web\ Access*)
# Really nasty hack, because for some reason, vmware-server 2 doesn't say done when it mentions this
einfon " ${line}"
echo
eend 0;;
*)
# Strip out anything after the <esc> code
message=`echo ${line} | sed -e "s/^\(.*\).*$/\1/"`
einfon " ${message}"
echo
echo ${line} | grep -q done
status=$?
eend ${status}
if [ ${status} -ne 0 ]
then
logger -p local0.err -t vmware-${state} "${line}"
waserror=${status}
fi
esac
continue
done
if [ ${waserror} -ne 0 ]
then
eend 1 "VMware is not properly configured! See above."
fi
return ${waserror}
}
start() {
test -x /etc/vmware/init.d/vmware || \
eend 1 "vmware init script not found. Aborting" || return 1
/etc/vmware/init.d/vmware start | vmware_prettify start
return $?
}
stop() {
/etc/vmware/init.d/vmware stop | vmware_prettify stop
return $?
}