[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] Check for, and uninstall, VMware Tools installed from tarball



VMware Tools can be installed by RPM or from a tarball. We were only looking for
the RPM. If it was installed by tarball, we would end up leaving it in place. If
VMware Tools detects that it is not running on a VMware platform when it starts,
it will clumsily try to uninstall itself, leading to misconfiguration.

This patch looks for tarball-installed VMware Tools and uninstalls it.

Fixes RHBZ#623571
---
 lib/Sys/VirtV2V/Converter/RedHat.pm |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/lib/Sys/VirtV2V/Converter/RedHat.pm b/lib/Sys/VirtV2V/Converter/RedHat.pm
index 762ee0e..114d876 100644
--- a/lib/Sys/VirtV2V/Converter/RedHat.pm
+++ b/lib/Sys/VirtV2V/Converter/RedHat.pm
@@ -756,6 +756,24 @@ sub _unconfigure_vmware
             _remove_application($name, $g);
         }
     }
+
+    # VMwareTools may have been installed from tarball, in which case the above
+    # won't detect it. Look for the uninstall tool, and run it if it's present.
+    #
+    # Note that it's important we do this early in the conversion process, as
+    # this uninstallation script naively overwrites configuration files with
+    # versions it cached from prior to installation.
+    my $vmwaretools = '/usr/bin/vmware-uninstall-tools.pl';
+    if ($g->exists($vmwaretools)) {
+        eval { $g->command([$vmwaretools]) };
+        warn user_message(__x('VMware Tools was detected, but uninstallation '.
+                              'failed. The error message was: {error}',
+                              error => $@)) if $@;
+
+        # Reload augeas to detect changed made by vmware tools uninstallation
+        eval { $g->aug_load() };
+        augeas_error($g, $@) if $@;
+    }
 }
 
 # Get a list of all foreign hypervisor specific kernel modules which are being
-- 
1.7.3.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]