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