77 lines
3.5 KiB
Diff
77 lines
3.5 KiB
Diff
From 5fda965d292bd1b5b62e47d357ddf046dfa007b6 Mon Sep 17 00:00:00 2001
|
|
From: Vadim Rozenfeld <vrozenfe@redhat.com>
|
|
Date: Thu, 10 Jul 2025 10:12:56 +1000
|
|
Subject: [PATCH] Modify configure_pnputil_install script to check pending
|
|
reboot status and report PnPUtil execution status
|
|
|
|
This change adds checks for system reboot status and reports
|
|
the result of PnPUtil driver installation attempt.
|
|
|
|
Related: https://issues.redhat.com/browse/RHEL-100682
|
|
|
|
Signed-off-by: Vadim Rozenfeld <vrozenfe@redhat.com>
|
|
(cherry picked from commit 594b05d6940c8719167d10c0cdfaa253349060ab)
|
|
---
|
|
convert/convert_windows.ml | 48 +++++++++++++++++++++++++++++++++++---
|
|
1 file changed, 45 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
|
|
index 71e867a5..8f0ff87b 100644
|
|
--- a/convert/convert_windows.ml
|
|
+++ b/convert/convert_windows.ml
|
|
@@ -396,9 +396,51 @@ let convert (g : G.guestfs) source inspect i_firmware
|
|
and configure_pnputil_install () =
|
|
let fb_script = "@echo off\n\
|
|
\n\
|
|
- echo Wait for VirtIO drivers to be installed\n\
|
|
- %systemroot%\\Sysnative\\PnPutil -i -a \
|
|
- %systemroot%\\Drivers\\Virtio\\*.inf" in
|
|
+ setlocal EnableDelayedExpansion\n\
|
|
+ set inf_dir=%systemroot%\\Drivers\\Virtio\\\n\
|
|
+ echo Installing drivers from %inf_dir%\n\
|
|
+ set REBOOT_PENDING=0\n\
|
|
+ \n\
|
|
+ timeout /t 10 /nobreak\n\
|
|
+ \n\
|
|
+ reg query \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired\"\n\
|
|
+ if %errorlevel%==0 (\n\
|
|
+ echo Windows Update: Reboot required.\n\
|
|
+ set REBOOT_PENDING=1\n\
|
|
+ )\n\
|
|
+ \n\
|
|
+ reg query \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\RebootPending\"\n\
|
|
+ if %errorlevel%==0 (\n\
|
|
+ echo CBS: Reboot required.\n\
|
|
+ set REBOOT_PENDING=1\n\
|
|
+ )\n\
|
|
+ \n\
|
|
+ reg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\" /v PendingFileRenameOperations\n\
|
|
+ if %errorlevel%==0 (\n\
|
|
+ echo Session Manager: Reboot required.\n\
|
|
+ set REBOOT_PENDING=1\n\
|
|
+ )\n\
|
|
+ \n\
|
|
+ if \"%REBOOT_PENDING%\"==\"1\" (\n\
|
|
+ echo A reboot is pending.\n\
|
|
+ exit /b 249\n\
|
|
+ ) else (\n\
|
|
+ echo No pending reboot detected.\n\
|
|
+ )\n\
|
|
+ \n\
|
|
+ for %%f in (\"%inf_dir%*.inf\") do (\n\
|
|
+ echo Installing: %%~nxf.\n\
|
|
+ %systemroot%\\Sysnative\\PnPutil -i -a \"%%f\"\n\
|
|
+ if !errorlevel! NEQ 0 (\n\
|
|
+ echo Failed to install %%~nxf.\n\
|
|
+ exit /b 249\n\
|
|
+ ) else (\n\
|
|
+ echo Successfully installed %%~nxf.\n\
|
|
+ )\n\
|
|
+ )\n\
|
|
+ echo All drivers installed successfully.\n\
|
|
+ exit /b 0\n\
|
|
+ )" in
|
|
|
|
(* Set priority higher than that of "network-configure" firstboot script. *)
|
|
Firstboot.add_firstboot_script g inspect.i_root ~prio:2000
|