[Libguestfs] [PATCH 2/2] windows: small tweaks of qemu-ga firstboot script

Tomáš Golembiovský tgolembi at redhat.com
Thu Nov 21 11:11:02 UTC 2019


- match log file with script name
- restart manually only after successfull install, this also helps
  debugging because we can log the installer return code

Signed-off-by: Tomáš Golembiovský <tgolembi at redhat.com>
---
 v2v/convert_windows.ml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index 5b7a5bfe..0fda1d4e 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -430,7 +430,13 @@ popd
      fun msi_path ->
        let fb_script = "\
 echo Installing qemu-ga from " ^ msi_path ^ "
-\"\\" ^ msi_path ^ "\" /qn /forcerestart /l+*vx \"%cd%\\qemu-ga.log\"
+\"\\" ^ msi_path ^ "\" /norestart /qn /l+*vx \"%~dpn0.log\"
+set elvl=!errorlevel!
+echo Done installing qemu-ga error_level=!elvl!
+if !elvl! == 0 (
+  echo Restarting Windows...
+  shutdown /r /f /c \"rebooted by firstboot script\"
+)
 " in
       Firstboot.add_firstboot_script g inspect.i_root
         ("install " ^ msi_path) fb_script;
-- 
2.24.0





More information about the Libguestfs mailing list