mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From d48436488af6a82504ceaa68f0ecbca153fb928f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 30 Apr 2015 16:23:26 +0100
Subject: [PATCH] v2v: efi: linux: Add support for grub2-efi.

(cherry picked from commit 9a45508f23451761fb3df825b17f2e32beb258d7)
---
 v2v/convert_linux.ml | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 3e97656..a1f5550 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -90,14 +90,20 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
 
   (* What grub is installed? *)
   let grub_config, grub =
+    let locations = [
+      "/boot/grub2/grub.cfg", `Grub2;
+      "/boot/grub/menu.lst", `Grub1;
+      "/boot/grub/grub.conf", `Grub1;
+    ] in
+    let locations =
+      if inspect.i_uefi then
+        ("/boot/efi/EFI/redhat/grub.cfg", `Grub2) :: locations
+      else
+        locations in
     try
       List.find (
         fun (grub_config, _) -> g#is_file ~followsymlinks:true grub_config
-      ) [
-        "/boot/grub2/grub.cfg", `Grub2;
-        "/boot/grub/menu.lst", `Grub1;
-        "/boot/grub/grub.conf", `Grub1;
-      ]
+      ) locations
     with
       Not_found ->
         error (f_"no grub1/grub-legacy or grub2 configuration file was found") in
-- 
1.8.3.1