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

7ed5e3
From 88429f56491ed0e5b3f5f91e6e352fa1251484bc Mon Sep 17 00:00:00 2001
7ed5e3
From: "Richard W.M. Jones" <rjones@redhat.com>
7ed5e3
Date: Mon, 30 Nov 2020 08:55:34 +0000
7ed5e3
Subject: [PATCH] v2v: windows: Fix schtasks /SD parameter.
7ed5e3
MIME-Version: 1.0
7ed5e3
Content-Type: text/plain; charset=UTF-8
7ed5e3
Content-Transfer-Encoding: 8bit
7ed5e3
7ed5e3
Thanks: Dinesh Herath, Tomáš Golembiovský, Bryan Kinney,  Mark Zealey
7ed5e3
7ed5e3
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1895323
7ed5e3
(cherry picked from commit b65711c9293415f671d35d0e2f9b55a74343da45)
7ed5e3
---
7ed5e3
 v2v/convert_windows.ml | 3 ++-
7ed5e3
 1 file changed, 2 insertions(+), 1 deletion(-)
7ed5e3
7ed5e3
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
7ed5e3
index 44cef5ed..4d844e2d 100644
7ed5e3
--- a/v2v/convert_windows.ml
7ed5e3
+++ b/v2v/convert_windows.ml
7ed5e3
@@ -422,11 +422,12 @@ popd
7ed5e3
  and configure_qemu_ga files =
7ed5e3
    List.iter (
7ed5e3
      fun msi_path ->
7ed5e3
+       (* Windows is a trashfire. https://stackoverflow.com/a/18730884 *)
7ed5e3
        let fb_script = sprintf "\
7ed5e3
 echo Removing any previously scheduled qemu-ga installation
7ed5e3
 schtasks.exe /Delete /TN Firstboot-qemu-ga /F
7ed5e3
 echo Scheduling delayed installation of qemu-ga from %s
7ed5e3
-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\\\"\"
7ed5e3
+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\\\"\"
7ed5e3
       "
7ed5e3
       msi_path msi_path msi_path in
7ed5e3
       Firstboot.add_firstboot_script g inspect.i_root
7ed5e3
-- 
7ed5e3
2.18.4
7ed5e3