v2v: windows: uninstall VMware Tools

It looks like VMware Tools support their unattended uninstallation even
after the guest is not running anymore on VMware.
This commit is contained in:
Pino Toscano
2018-11-07 17:33:10 +01:00
parent d6c4b90b00
commit 7cbd7bf209

View File

@@ -192,6 +192,13 @@ let convert (g : G.guestfs) inspect source output rcaps =
Some "PREVENT_REBOOT=Yes LAUNCHED_BY_SETUP_EXE=Yes" in
unistallation_commands "Parallels Tools" matchfn extra_uninstall_string in
(* Locate and retrieve all uninstallation commands for VMware Tools. *)
let vmwaretools_uninst =
let matchfn s =
String.find s "VMware Tools" != -1
in
unistallation_commands "VMware Tools" matchfn None in
(*----------------------------------------------------------------------*)
(* Perform the conversion of the Windows guest. *)
@@ -277,7 +284,8 @@ let convert (g : G.guestfs) inspect source output rcaps =
configure_vmdp tool_path;
unconfigure_xenpv ();
unconfigure_prltools ()
unconfigure_prltools ();
unconfigure_vmwaretools ()
(* [set_reg_val_dword_1 path name] creates a registry key
* called [name = dword:1] in the registry [path].
@@ -430,6 +438,23 @@ if errorlevel 3010 exit /b 0
"uninstall Parallels tools" fb_script
) prltools_uninsts
and unconfigure_vmwaretools () =
List.iter (
fun uninst ->
let fb_script = "\
@echo off
echo uninstalling VMware Tools
" ^ uninst ^
(* ERROR_SUCCESS_REBOOT_REQUIRED == 3010 is OK too *)
"
if errorlevel 3010 exit /b 0
" in
Firstboot.add_firstboot_script g inspect.i_root
"uninstall VMware Tools" fb_script
) vmwaretools_uninst
and update_system_hive reg =
(* Update the SYSTEM hive. When this function is called the hive has
* already been opened as a hivex handle inside guestfs.