Blame SOURCES/0031-v2v-windows-Fix-schtasks-SD-parameter.patch

61e9b3
From 88429f56491ed0e5b3f5f91e6e352fa1251484bc Mon Sep 17 00:00:00 2001
61e9b3
From: "Richard W.M. Jones" <rjones@redhat.com>
61e9b3
Date: Mon, 30 Nov 2020 08:55:34 +0000
61e9b3
Subject: [PATCH] v2v: windows: Fix schtasks /SD parameter.
61e9b3
MIME-Version: 1.0
61e9b3
Content-Type: text/plain; charset=UTF-8
61e9b3
Content-Transfer-Encoding: 8bit
61e9b3
61e9b3
Thanks: Dinesh Herath, Tomáš Golembiovský, Bryan Kinney,  Mark Zealey
61e9b3
61e9b3
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1895323
61e9b3
(cherry picked from commit b65711c9293415f671d35d0e2f9b55a74343da45)
61e9b3
---
61e9b3
 v2v/convert_windows.ml | 3 ++-
61e9b3
 1 file changed, 2 insertions(+), 1 deletion(-)
61e9b3
61e9b3
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
61e9b3
index 44cef5ed..4d844e2d 100644
61e9b3
--- a/v2v/convert_windows.ml
61e9b3
+++ b/v2v/convert_windows.ml
61e9b3
@@ -422,11 +422,12 @@ popd
61e9b3
  and configure_qemu_ga files =
61e9b3
    List.iter (
61e9b3
      fun msi_path ->
61e9b3
+       (* Windows is a trashfire. https://stackoverflow.com/a/18730884 *)
61e9b3
        let fb_script = sprintf "\
61e9b3
 echo Removing any previously scheduled qemu-ga installation
61e9b3
 schtasks.exe /Delete /TN Firstboot-qemu-ga /F
61e9b3
 echo Scheduling delayed installation of qemu-ga from %s
61e9b3
-powershell.exe -command \"$d = (get-date).AddSeconds(120); schtasks.exe /Create /SC ONCE /ST $d.ToString('HH:mm') /SD $d.ToString('MM/dd/yyyy') /RU SYSTEM /TN Firstboot-qemu-ga /TR \\\"C:\\%s /forcerestart /qn /l+*vx C:\\%s.log\\\"\"
61e9b3
+powershell.exe -command \"$d = (get-date).AddSeconds(120); $FormatHack = ($([System.Globalization.DateTimeFormatInfo]::CurrentInfo.ShortDatePattern) -replace 'M+/', 'MM/') -replace 'd+/', 'dd/'; schtasks.exe /Create /SC ONCE /ST $d.ToString('HH:mm') /SD $d.ToString($FormatHack) /RU SYSTEM /TN Firstboot-qemu-ga /TR \\\"C:\\%s /forcerestart /qn /l+*vx C:\\%s.log\\\"\"
61e9b3
       "
61e9b3
       msi_path msi_path msi_path in
61e9b3
       Firstboot.add_firstboot_script g inspect.i_root
61e9b3
-- 
61e9b3
2.27.0
61e9b3