virt-v2v/0006-Pull-in-a-fix-to-make-Windows-firstboot-more-reliabl.patch
2024-08-12 13:34:13 +01:00

79 lines
3.0 KiB
Diff

From 50f005f8b7034916588855c15b10a0195bf54b23 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 8 Aug 2024 10:40:24 +0100
Subject: [PATCH] Pull in a fix to make Windows firstboot more reliable.
Update the common submodule to get:
Richard W.M. Jones (2):
mlcustomize: Add some comments to firstboot batch file
mlcustomize: Reboot Windows between each firstboot script
Document that Windows may now reboot several times after conversion.
---
common | 2 +-
docs/virt-v2v.pod | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
Submodule common 7b84a370..a7883967:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 3bbba714..52e76401 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -278,6 +278,9 @@ module Windows = struct
(* Write a firstboot.bat control script which just runs the other
* scripts in the directory. Note we need to use CRLF line endings
* in this script.
+ *
+ * XXX It would be better to use powershell here. For some ideas see
+ * https://github.com/HCK-CI/HLK-Setup-Scripts/
*)
let firstboot_script = sprintf "\
@echo off
@@ -299,6 +302,7 @@ if not exist \"%%scripts_done%%\" (
mkdir \"%%scripts_done%%\"
)
+:: Pick the next script to run.
for %%%%f in (\"%%scripts%%\"\\*.bat) do (
echo running \"%%%%f\"
move \"%%%%f\" \"%%scripts_done%%\"
@@ -307,8 +311,17 @@ for %%%%f in (\"%%scripts%%\"\\*.bat) do (
set elvl=!errorlevel!
echo .... exit code !elvl!
popd
+
+ :: Reboot the computer. This is necessary to free any locked
+ :: files which may prevent later scripts from running.
+ shutdown /r /t 0 /y
+
+ :: Exit the script (in case shutdown returns before rebooting).
+ :: On next boot, the whole firstboot service will be called again.
+ exit /b
)
+:: Fallthrough here if there are no scripts.
echo uninstalling firstboot service
\"%%firstboot%%\\%s\" -s firstboot uninstall
" firstboot_dir_win srvany in
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index 92941026..587b4604 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -1295,9 +1295,12 @@ The guest will be bootable after the offline conversion stage, but
will not yet have all necessary drivers installed to work correctly.
These will be installed automatically the first time the guest boots.
-B<N.B.> Take care not to interrupt the automatic driver installation
-process when logging in to the guest for the first time, as this may
-prevent the guest from subsequently booting correctly.
+B<N.B.> Windows may reboot 4 or more times the first time after
+conversion. This is required to install the required drivers, guest
+agents, remove VMware Tools, and configure the network. Take care not
+to interrupt the automatic driver installation process when logging in
+to the guest for the first time, as this may prevent the guest from
+subsequently booting correctly.
=head3 Removing VMware Tools from Windows guests