mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0007-v2v-linux-do-not-uninstall-open-vm-tools-w-ubuntu-se.patch

46b2f6
From 51367a1f2d4a5c54564a6bcaf8c193de643d3ee4 Mon Sep 17 00:00:00 2001
46b2f6
From: Pino Toscano <ptoscano@redhat.com>
46b2f6
Date: Wed, 27 Feb 2019 17:51:59 +0100
46b2f6
Subject: [PATCH] v2v: linux: do not uninstall open-vm-tools w/ ubuntu-server
46b2f6
46b2f6
ubuntu-server depends on open-vm-tools on Ubuntu, so if v2v tries to
46b2f6
uninstall open-vm-tools then dpkg will (rightfully) fail with a
46b2f6
dependency issue.
46b2f6
46b2f6
Since open-vm-tools is harmless after the conversion anyway (it will
46b2f6
not even run), then do not attempt to uninstall it if ubuntu-server is
46b2f6
installed too.
46b2f6
46b2f6
Followup of commit 2bebacf8bf611f0f80a66915f78653ce30b38129.
46b2f6
46b2f6
Thanks to: Ming Xie.
46b2f6
46b2f6
(cherry picked from commit 1a4fd822ef057764f809cddce642b3223756629e)
46b2f6
---
46b2f6
 v2v/convert_linux.ml | 14 +++++++++++++-
46b2f6
 1 file changed, 13 insertions(+), 1 deletion(-)
46b2f6
46b2f6
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
46b2f6
index 3d61400b5..b4b2f24c4 100644
46b2f6
--- a/v2v/convert_linux.ml
46b2f6
+++ b/v2v/convert_linux.ml
46b2f6
@@ -289,6 +289,18 @@ let convert (g : G.guestfs) inspect source output rcaps =
46b2f6
 
46b2f6
     (* Uninstall VMware Tools. *)
46b2f6
     let remove = ref [] and libraries = ref [] in
46b2f6
+    (* On Ubuntu, the ubuntu-server metapackage depends on
46b2f6
+     * open-vm-tools, and thus any attempt to remove it will cause
46b2f6
+     * dependency issues.  Hence, special case this situation, and
46b2f6
+     * leave open-vm-tools installed in this case.
46b2f6
+     *)
46b2f6
+    let has_ubuntu_server =
46b2f6
+      if family = `Debian_family then
46b2f6
+        List.exists (
46b2f6
+          fun { G.app2_name = name } ->
46b2f6
+            name = "ubuntu-server"
46b2f6
+        ) inspect.i_apps
46b2f6
+      else false in
46b2f6
     List.iter (
46b2f6
       fun { G.app2_name = name } ->
46b2f6
         if String.is_prefix name "vmware-tools-libraries-" then
46b2f6
@@ -301,7 +313,7 @@ let convert (g : G.guestfs) inspect source output rcaps =
46b2f6
           List.push_front name remove
46b2f6
         else if String.is_prefix name "open-vm-tools-" then
46b2f6
           List.push_front name remove
46b2f6
-        else if name = "open-vm-tools" then
46b2f6
+        else if name = "open-vm-tools" && not has_ubuntu_server then
46b2f6
           List.push_front name remove
46b2f6
     ) inspect.i_apps;
46b2f6
     let libraries = !libraries in
46b2f6
-- 
46b2f6
2.24.1
46b2f6