summaryrefslogtreecommitdiff
path: root/community-testing/open-vm-tools/open-vm-tools.rc.d
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-04-11 10:57:18 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-04-11 10:57:18 -0300
commitc07ca5cb71d277e9f2fd5c7b94cf8a0021bdfab5 (patch)
treed9d528762b726855cc356781c89abb1768c8be28 /community-testing/open-vm-tools/open-vm-tools.rc.d
parentece2137c9569ec806aacf3740df98c399a51b21a (diff)
parent8119da2eaadf53531cad2aed70981ed4606340d6 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community-testing/sword/PKGBUILD community/freedroidrpg/PKGBUILD community/pgadmin3/PKGBUILD libre/lame-libre/PKGBUILD testing/dbus-core/PKGBUILD testing/libwebkit/PKGBUILD testing/tracker/PKGBUILD testing/udev/0001-split-usr-always-read-config-files-from-lib-udev.patch testing/udev/0002-reinstate-TIMEOUT-handling.patch testing/udev/PKGBUILD
Diffstat (limited to 'community-testing/open-vm-tools/open-vm-tools.rc.d')
-rw-r--r--community-testing/open-vm-tools/open-vm-tools.rc.d101
1 files changed, 101 insertions, 0 deletions
diff --git a/community-testing/open-vm-tools/open-vm-tools.rc.d b/community-testing/open-vm-tools/open-vm-tools.rc.d
new file mode 100644
index 000000000..0c9221489
--- /dev/null
+++ b/community-testing/open-vm-tools/open-vm-tools.rc.d
@@ -0,0 +1,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 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 $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