>From b75ffe4552147b048397af579ba447ad7d5e04ba Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 24 Jul 2020 15:14:07 +0100 Subject: [PATCH] UPDATE --- v2v/convert_linux.ml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index 9115b9fbcf..a871d754f4 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -1105,20 +1105,12 @@ let convert (g : G.guestfs) inspect source_disks output rcaps _ = The following code tries to make an uefi fallback path for a uefi linux vm. *) - match inspect.i_firmware with - | I_UEFI _ -> ( + (match inspect.i_firmware with + | I_BIOS -> () + | I_UEFI _ -> (* Standard uefi fallback path *) let uefi_fallback_path = "/boot/efi/EFI/BOOT/" in - (* Helper function checks if 'source' contains 's' *) - let contains source s = ( - let re = Str.regexp_string s in - try - ignore (Str.search_forward re source 0); - true - with Not_found -> false - ) in - let cant_fix_uefi () = info (f_"Can't fix UEFI bootloader. VM may not boot.") in @@ -1199,7 +1191,7 @@ rm -rf %s" uefi_fallback_path in * if not, then just don't clean up and leave the temp loader * at UEFI fallback path for simplicity *) - if contains shim "/boot/efi/EFI/ubuntu/shim" then + if String.find shim "/boot/efi/EFI/ubuntu/shim" >= 0 then let fix_script = sprintf "#!/bin/bash sudo efibootmgr -c -L ubuntu -l \\\\EFI\\\\ubuntu\\\\shim%s.efi @@ -1207,7 +1199,8 @@ rm -rf %s" arch_suffix uefi_fallback_path in Firstboot.add_firstboot_script g inspect.i_root "fix uefi boot" fix_script else - ()) + () + ) else cant_fix_uefi () | _, _ -> @@ -1216,8 +1209,7 @@ rm -rf %s" arch_suffix uefi_fallback_path in cant_fix_uefi () ) ) - ) - | I_BIOS -> (); + ); (* inspect.i_firmware == I_UEFI *) (* Delete blkid caches if they exist, since they will refer to the old * device names. blkid will rebuild these on demand. -- 2.26.2