Instead of running firstboot script during early boot schedule a task
delayed for 1-2 minute.
During the first boot, after virt-v2v conversion, Windows installs the
drivers injected by virit-v2v. When this installation is finished
Windows enforces some kind of internal reboot. This unfortunately
terminates any running firstboot scritps thus killing the installation
of qemu-ga MSI.
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
v2v/convert_windows.ml | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index 0fda1d4e..0a146006 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -429,14 +429,10 @@ popd
List.iter (
fun msi_path ->
let fb_script = "\
-echo Installing qemu-ga from " ^ msi_path ^ "
-\"\\" ^ 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\"
-)
+echo Removing any previously scheduled qemu-ga installation
+schtasks.exe /Delete /TN Firstboot-qemu-ga /F
+echo Scheduling delayed installation of qemu-ga from " ^ msi_path ^ "
+powershell.exe -command \"$d = (get-date).AddSeconds(119); schtasks.exe /Create /SC
ONCE /ST $d.ToString('HH:mm') /SD $d.ToString('MM/dd/yyyy') /RU SYSTEM /TN
Firstboot-qemu-ga /TR \\\"C:\\" ^ msi_path ^ " /forcerestart /qn /l+*vx
C:\\" ^ msi_path ^ ".log\\\"\"
" in
Firstboot.add_firstboot_script g inspect.i_root
("install " ^ msi_path) fb_script;
--
2.25.0