b8698aba17
resolves: RHEL-49761
110 lines
4.2 KiB
Diff
110 lines
4.2 KiB
Diff
From 8f8cd939ec7cbddad48cb03e522a21525b2a7706 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Thu, 25 Jul 2024 09:08:41 +0100
|
|
Subject: [PATCH] Update common submodule
|
|
|
|
This pulls in the commits below which simplify the installation of
|
|
Qemu Guest Agent on Windows.
|
|
|
|
Richard W.M. Jones (4):
|
|
mlcustomize: firstboot: Use Linux path for Powershell script path
|
|
mlcustomize: firstboot: Use powershell.exe instead of path
|
|
mlcustomize: firstboot: Use Powershell -NoProfile flag
|
|
mlcustomize: Revert delay installation of qemu-ga MSI
|
|
|
|
Fixes: https://issues.redhat.com/browse/RHEL-49761
|
|
(cherry picked from commit 4ba18d2d6d1155db7cd83641a650477c0a13dbec)
|
|
---
|
|
common | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
Submodule common 830cbdcf..5d1f5b84:
|
|
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
|
|
index 5dc01234..4b9b910b 100644
|
|
--- a/common/mlcustomize/firstboot.ml
|
|
+++ b/common/mlcustomize/firstboot.ml
|
|
@@ -387,16 +387,10 @@ let add_firstboot_powershell g root ?prio name code =
|
|
(* Create the temporary directory to put the Powershell file. *)
|
|
let tempdir = sprintf "%s/Temp" windows_systemroot in
|
|
g#mkdir_p tempdir;
|
|
+ let ps_path = sprintf "%s/%s" tempdir name in
|
|
let code = String.concat "\r\n" code ^ "\r\n" in
|
|
- g#write (sprintf "%s/%s" tempdir name) code;
|
|
+ g#write ps_path code;
|
|
|
|
- (* Powershell interpreter. Should we check this exists? XXX *)
|
|
- let ps_exe =
|
|
- windows_systemroot ^
|
|
- "\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" in
|
|
-
|
|
- (* Windows path to the Powershell script. *)
|
|
- let ps_path = windows_systemroot ^ "\\Temp\\" ^ name in
|
|
-
|
|
- let fb = sprintf "%s -ExecutionPolicy ByPass -file %s" ps_exe ps_path in
|
|
+ let fb = sprintf "powershell.exe -ExecutionPolicy ByPass -NoProfile -file %s"
|
|
+ ps_path in
|
|
add_firstboot_script g root ?prio name fb
|
|
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
|
|
index 4e0ed0e0..eee93669 100644
|
|
--- a/common/mlcustomize/inject_virtio_win.ml
|
|
+++ b/common/mlcustomize/inject_virtio_win.ml
|
|
@@ -575,40 +575,28 @@ and copy_from_libosinfo { g; i_osinfo; i_arch } destdir =
|
|
) driver.Libosinfo.files
|
|
with Not_found -> []
|
|
|
|
+(* Install qemu-ga. [files] is the non-empty list of possible qemu-ga
|
|
+ * installers we detected.
|
|
+ *)
|
|
and configure_qemu_ga t files =
|
|
+ let script = ref [] in
|
|
+ let add = List.push_back script in
|
|
+
|
|
+ add "# Virt-v2v script which installs QEMU Guest Agent";
|
|
+ add "";
|
|
+ add "# Uncomment this line for lots of debug output.";
|
|
+ add "# Set-PSDebug -Trace 2";
|
|
+ add "";
|
|
+ add "Write-Host Installing QEMU Guest Agent";
|
|
+ add "";
|
|
+ add "# Run qemu-ga installers";
|
|
List.iter (
|
|
fun msi_path ->
|
|
- (* Windows is a trashfire.
|
|
- * https://stackoverflow.com/a/18730884
|
|
- * https://bugzilla.redhat.com/show_bug.cgi?id=1895323
|
|
- *)
|
|
- let psh_script = ref [] in
|
|
- let add = List.push_back psh_script in
|
|
+ add (sprintf "C:\\%s /norestart /qn /l+*vx C:\\%s.log"
|
|
+ msi_path msi_path)
|
|
+ ) files;
|
|
|
|
- add "# Uncomment this line for lots of debug output.";
|
|
- add "# Set-PSDebug -Trace 2";
|
|
- add "";
|
|
- add "Write-Host Removing any previously scheduled qemu-ga installation";
|
|
- add "schtasks.exe /Delete /TN Firstboot-qemu-ga /F";
|
|
- add "";
|
|
- add (sprintf
|
|
- "Write-Host Scheduling delayed installation of qemu-ga from %s"
|
|
- msi_path);
|
|
- add "$d = (get-date).AddSeconds(120)";
|
|
- add "$dtfinfo = [System.Globalization.DateTimeFormatInfo]::CurrentInfo";
|
|
- add "$sdp = $dtfinfo.ShortDatePattern";
|
|
- add "$sdp = $sdp -replace 'y+', 'yyyy'";
|
|
- add "$sdp = $sdp -replace 'M+', 'MM'";
|
|
- add "$sdp = $sdp -replace 'd+', 'dd'";
|
|
- add "schtasks.exe /Create /SC ONCE `";
|
|
- add " /ST $d.ToString('HH:mm') /SD $d.ToString($sdp) `";
|
|
- add " /RU SYSTEM /TN Firstboot-qemu-ga `";
|
|
- add (sprintf " /TR \"C:\\%s /forcerestart /qn /l+*vx C:\\%s.log\""
|
|
- msi_path msi_path);
|
|
-
|
|
- Firstboot.add_firstboot_powershell t.g t.root
|
|
- (sprintf "install-%s.ps1" msi_path) !psh_script;
|
|
- ) files
|
|
+ Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga.ps1" !script
|
|
|
|
and configure_blnsvr t blnsvr =
|
|
let cmd = sprintf "\
|