mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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