request: only generate ISO if updates changed (with code)

request: only generate ISO if updates changed (with code)

Postby skhall » 08.08.2018, 06:37

Feature request (with code submission):

Currently, WOU generates new ISO files with every run if the option is enabled, even if nothing has changed since the last run (excepting Definition Updates, which in my case are not selected).

I would like to be able to exclude the generation of ISO files whenever none of the ".\client\w*\*" files have been changed. This will significantly reduce the amount of time both to run WOU and sync changes to my USB drives.

I see three ways to implement this.

#1 One is to run forfiles to find the latest timestamp of the latest file. This would be resource intensive during processing.

#2 Another way is to store the timestamp of the cached wsusscn2.cab before running ":DownloadWSUS" and compare it to the timestamp after download is completed. This would likely be the simplest logic to impose directly on the entire platform.

#3 The last way is to compare the timestamp of wsusscn2.cab to the timestamp of the previous individual ISO immediately before performing the write operation (CreateISOImage.cmd @203).

In either case, if the timestamps are the same, either don't run CreateISOImage.cmd or don't run mkisofs.

Unfortunately, it appears that WOU performs most of its functionality by being called many times, which means that if I download w61 and w62 and w63 and w100 then it'll fail to understand the logic above for the later downloads because the check for w61 forces an update to wsusscn2.cab.

Here's a line that can be added immediately before the existing ISO is deleted at 193 in CreateISOImage.cmd to effect timestamp comparisons for the specific ISO file (option 3 above - actually added above 192 to ensure it doesn't say it's going to create the ISO unless it actually is):
Code: Select all
xcopy /DYLR "..\client\wsus\wsusscn2.cab" "%OUTPUT_PATH%\%ISO_NAME%.iso*" | findstr /BC:"0" >nul && @echo ISO is newer than wsusscn2.cab, skipping ISO creation && GOTO EoF


This specific change works even if the ISO file does not exist, since the xcopy will err and skip the continue ("&&") which allows it to goto EoF.

I have tested this on my own install of 11.4 and it is working well.


For those with Definition Updates enabled this would need to be adjusted to compare vs the definition files, which could be performed in ExtendFilter as assignments are being made to include/exclude them. The test should also default to testing against wsusscn2.cab just in case there are regular files that are newer than the definitions (an edge case, but it's possible). Something like this in CreateISOImage.cmd:

@ roughly line 10
Code: Select all
SET isobuildcompare=..\client\wsus\wsusscn2.cab


at the end of ExtendFilter @ roughly line 149
Code: Select all
set isobuildfor=%1
if "%INC_MSSE%" EQU "1" (
  if not x%isobuildfor:x64=%==x%isobuildfor% (
    set isobuildcompare=..\client\msse\x64-glb\mpam-fex64.exe
  ) else (
    set isobuildcompare=..\client\msse\x86-glb\mpam-fe.exe
  )
  xcopy /DYLR "..\client\wsus\wsusscn2.cab" "%isobuildcompare%*" | findstr /BC:"0" >nul && SET isobuildcompare=..\client\wsus\wsusscn2.cab
)
if "%INC_WDDEFS%" EQU "1" (
  if not x%isobuildfor:x64=%==x%isobuildfor% (
    set isobuildcompare=..\client\wddefs\x64-glb\mpas-feX64.exe
  ) else (
    set isobuildcompare=..\client\wddefs\x86-glb\mpas-fe.exe
  )
  xcopy /DYLR "..\client\wsus\wsusscn2.cab" "%isobuildcompare%*" | findstr /BC:"0" >nul && SET isobuildcompare=..\client\wsus\wsusscn2.cab
)


and @ 192:
Code: Select all
xcopy /DYLR "%isobuildcompare%" "%OUTPUT_PATH%\%ISO_NAME%.iso*" | findstr /BC:"0" >nul && @echo ISO is newer than %isobuildcompare%, skipping ISO creation && GOTO EoF


Be aware that I have *not* tested the definitions extension to the feature request above since I do not personally want definitions to be included, but the vaporcode above should work.

Thanks for considering these changes. :)
skhall
 
Posts: 2
Joined: 22.04.2016, 22:19

Re: request: only generate ISO if updates changed (with code

Postby Rush » 09.08.2018, 19:17

sehr gut ... ich bin dafür, hatte ich auch schon mal drüber nachgedacht :)
Rush
 
Posts: 175
Joined: 09.08.2015, 19:05


Return to Anregungen / Suggestions

Who is online

Users browsing this forum: Google [Bot] and 15 guests