mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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