From fcd2fa293b9f77fe8b22dadeb7246f8ca20e629d Mon Sep 17 00:00:00 2001 From: Ravindra Kumar Date: Tue, 15 Sep 2015 03:14:07 -0700 Subject: [PATCH] Setup and teardown Shared Folders mount point --- open-vm-tools.spec | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/open-vm-tools.spec b/open-vm-tools.spec index 413ca8c..ad204c4 100644 --- a/open-vm-tools.spec +++ b/open-vm-tools.spec @@ -28,7 +28,7 @@ Name: open-vm-tools Version: %{toolsversion} -Release: 4%{?dist} +Release: 5%{?dist} Summary: Open Virtual Machine Tools for virtual machines hosted on VMware Group: Applications/System License: GPLv2 @@ -171,11 +171,19 @@ install -p -m 644 -D %{SOURCE2} %{buildroot}%{_unitdir}/%{vgauthdaemon}.service # upstream %post -if [ -e %{_bindir}/vmware-guestproxycerttool ]; then +if [ -f %{_bindir}/vmware-guestproxycerttool ]; then mkdir -p %{_sysconfdir}/vmware-tools/GuestProxyData/server mkdir -p -m 0700 %{_sysconfdir}/vmware-tools/GuestProxyData/trusted %{_bindir}/vmware-guestproxycerttool -g &> /dev/null || /bin/true fi + +# Setup mount point for Shared Folders +if [ -f %{_bindir}/vmware-checkvm ] && \ + %{_bindir}/vmware-checkvm &> /dev/null && \ + %{_bindir}/vmware-checkvm -p | grep -q Workstation; then + mkdir -p /mnt/hgfs +fi + /sbin/ldconfig %systemd_post %{vgauthdaemon}.service %systemd_post %{toolsdaemon}.service @@ -184,12 +192,21 @@ fi %systemd_preun %{toolsdaemon}.service %systemd_preun %{vgauthdaemon}.service -# Tell VMware that open-vm-tools is being uninstalled -if [ "$1" = "0" -a \ - -e %{_bindir}/vmware-checkvm -a \ - -e %{_bindir}/vmware-rpctool ] && \ - %{_bindir}/vmware-checkvm &> /dev/null; then - %{_bindir}/vmware-rpctool 'tools.set.version 0' &> /dev/null || /bin/true +if [ "$1" = "0" -a \ + -f %{_bindir}/vmware-checkvm ] && \ + %{_bindir}/vmware-checkvm &> /dev/null; then + + # Tell VMware that open-vm-tools is being uninstalled + if [ -f %{_bindir}/vmware-rpctool ]; then + %{_bindir}/vmware-rpctool 'tools.set.version 0' &> /dev/null || /bin/true + fi + + # Teardown mount point for Shared Folders + if [ -d /mnt/hgfs ] && \ + %{_bindir}/vmware-checkvm -p | grep -q Workstation; then + umount /mnt/hgfs &> /dev/null || /bin/true + rmdir /mnt/hgfs &> /dev/null || /bin/true + fi fi %postun @@ -197,7 +214,7 @@ fi %systemd_postun_with_restart %{toolsdaemon}.service %systemd_postun_with_restart %{vgauthdaemon}.service # Cleanup GuestProxy certs if open-vm-tools is being uninstalled -if [ "$1" = "0" ]; then \ +if [ "$1" = "0" ]; then rm -rf %{_sysconfdir}/vmware-tools/GuestProxyData &> /dev/null || /bin/true fi @@ -262,6 +279,10 @@ fi %{_libdir}/libvmtools.so %changelog +* Thu Oct 01 2015 Ravindra Kumar - 10.0.0-5 +- Setup and teardown Shared Folders mount point on VMs running + on VMware Workstation or VMware Fusion. + * Wed Sep 30 2015 Ravindra Kumar - 10.0.0-4 - vmhgfs-fuse needs 'fusermount' from 'fuse'