diff --git a/customize/firstboot.ml b/customize/firstboot.ml index 1f4a940de..f1e5807bc 100644 --- a/customize/firstboot.ml +++ b/customize/firstboot.ml @@ -193,13 +193,7 @@ module Windows = struct let srvany = try List.find ( - fun service -> - try - let chan = open_in (virt_tools_data_dir // service) in - close_in chan; - true - with _ -> - false + fun service -> Sys.file_exists (virt_tools_data_dir // service) ) services with Not_found -> error (f_"One of rhsrvany.exe or pvvxsvc.exe is missing in %s. One of them is required in order to install Windows firstboot scripts. You can get one by building rhsrvany (https://github.com/rwmjones/rhsrvany)") diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml index abb83cb63..7d42a7f49 100644 --- a/v2v/convert_windows.ml +++ b/v2v/convert_windows.ml @@ -48,14 +48,7 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source rcaps = let installer = try let t, tool = List.find ( - fun (_, tool) -> - try ( - let exe_path = virt_tools_data_dir // tool in - let chan = open_in exe_path in - close_in chan; - true - ) with _ -> - false + fun (_, tool) -> Sys.file_exists (virt_tools_data_dir // tool) ) tools in Some (t, virt_tools_data_dir // tool) with Not_found -> (