[EMAIL PROTECTED] wrote:

>> Without running vmware-guestd some important functions of the Virtual
>> Infrastructur Client are not available.

> this is not a serious bug. and yes, i'll add one soon.

I extracted (and attached) the init-script from the Ubuntu patch and
adapted it to the debian package.

BTW: A backport to Etch would be much appreciated.

S°
#!/bin/sh
### BEGIN INIT INFO
# Provides: open-vm-tools
# Required-Start:
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 6
# Description: Runs the open-vm-tools services
# Short-Description: Runs the open-vm-tools services
### END INIT INFO

. /lib/lsb/init-functions

vmxnet_needed () {
        hwversion=`vmware-checkvm -h | head -1 | cut -f5 -d\ `
        for dev in /sys/bus/pci/devices/*
        do
                if grep -q 15ad $dev && grep -q 0720 $dev
                then
                        return 0
                fi
                if [ $hwversion -ge 4 ] && grep -q 1022 $dev && grep -q 2000 
$dev
                then
                        return 0
                fi
        done
        return 1
}

exit_if_not_in_vm () {
        if ! [ -x /usr/sbin/vmware-checkvm ] || ! /usr/sbin/vmware-checkvm > 
/dev/null 2>&1
        then
                echo "Not starting as we're not running in a vm"
                exit 0
        fi
}

case "$1" in
        start)
                # Check if we're running inside VMWare
                exit_if_not_in_vm

                log_daemon_msg "Loading open-vm-tools modules"
                log_progress_msg "vmhgfs"; modprobe vmhgfs
                log_progress_msg "vmmemctl"; modprobe vmmemctl
                log_end_msg 0
                if vmxnet_needed 
                then
                        rmmod pcnet32
                        modprobe vmxnet
                fi
                log_daemon_msg "Starting open-vm guest daemon" "vmware-guestd"
                vmware-guestd --background /var/run/vmware-guestd.pid
                log_end_msg 0
        ;;
        stop)
                # Check if we're running inside VMWare
                exit_if_not_in_vm

                log_daemon_msg "Stopping open-vm guest daemon" "vmware-guestd"
                if [ -f /var/run/vmware-guestd.pid ]
                then
                        kill `cat /var/run/vmware-guestd.pid`
                fi 
                log_end_msg 0
                if vmxnet_needed 
                then
                        rmmod vmxnet
                        modprobe pcnet32
                fi
                log_daemon_msg "Removing open-vm-tools modules"
                log_progress_msg "vmhgfs"; modprobe -r vmhgfs
                log_progress_msg "vmmemctl"; modprobe -r vmmemctl
                log_end_msg 0
                
        ;;
        force-reload|restart)
                $0 stop ;  $0 start
        ;;
        *)
                log_success_msg "Usage: /etc/init.d/open-vm-tools 
{start|stop|restart|force-reload}"
                exit 1
        ;;
esac
        




Reply via email to