#!/sbin/runscript # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ DND_TMPDIR="/tmp/VmwareDnD" USER_GROUP="root:vmware" DND_TMPDIR_PERMS="770" GUESTD_BIN="/usr/sbin/vmware-guestd" LOGFLE="/var/log/vmware-guestd.log" PIDFILE="/var/run/vmware-guestd.pid" depend() { before checkfs net X } start() { if ! grep -q -w vmblock /proc/modules; then ewarn "The module 'vmblock' is not loaded. Catching up now..." if modprobe vmblock; then einfo "Successfully loaded 'vmblock' module" else eerror "Error loading the 'vmblock' module" return 1 fi fi if [[ ! -d "${DND_TMPDIR}" ]]; then einfo "${DND_TMPDIR} wasn't found. Creating it..." mkdir "${DND_TMPDIR}" chown "${USER_GROUP}" "${DND_TMPDIR}" chmod "${DND_TMPDIR_PERMS}" "${DND_TMPDIR}" fi einfo "Starting vmware-guestd..." start-stop-daemon --chuid "${USER_GROUP}" --start --quiet --exec ${GUESTD_BIN} -- --background "${PIDFILE}" } stop() { einfo "Stopping vmware-guestd..." eindent 5 einfo "Removing the contents of ${DND_TMPDIR}" # First check, whether ${DND_TMPDIR} isn valid... we shouldn't risk deleting the content of ""/* if [[ ! -z "${DND_TMPDIR}" ]] && [[ "${DND_TMPDIR}" != "/" ]]; then rm -rf ${DND_TMPDIR}/* else eerror "Not cleaning up ${DND_TMPDIR}, please check definition of variable" fi eoutdent 5 start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" } restart() { einfo "Restarting vmware-guestd" eindent 5 svc_stop svc_start eoutdent 5 }