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

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