Since I'm a quite curious type of human being and sometimes cannot wait, until a new official release of WSUS Offline Update is out, I use the development releases from the trunk, downloaded as zip. However, these archives need a few preparational steps in order to use the contained files for downloading and updating:
- Unpack the trunk archive (source files).
- Create an empty directory for the build.
- Run the batch PrepareReleaseTree.cmd, which is contained in the trunk archive, with the empty directory as parameter.
- Erase the source files (clean up).
- Code: Select all
@echo off
rem ------------------------------------------------------------
rem --- BuildLatestTrunk.cmd 1.2.0 (2018-08-14) ---
rem --- ---
rem --- Facilitate a build from a WSUS Offline Update ---
rem --- trunk. The latest trunk revision (trunk-*.zip) ---
rem --- from the current directory is used. ---
rem --- ---
rem --- by Gerby ---
rem --- ---
rem --- See WSUS Offline Update forums for more information: ---
rem --- http://forums.wsusoffline.net/viewtopic.php?t=43 ---
rem ------------------------------------------------------------
setlocal
title Build Latest Trunk - WSUS Offline Update
rem --- Check for UnZip utility --------------------------------
if not exist unzip.exe (
for %%U in (unzip.exe) do if "%%~$PATH:U"=="" goto NoUnzip
)
rem --- Search for latest trunk --------------------------------
rem --- Use latest marked trunk (prefix !) if it exists --------
set TrunkSearcher=trunk-*.zip
set MarkedTrunkSearcher=!%TrunkSearcher%
if exist %MarkedTrunkSearcher% (set TrunkSearcher=%MarkedTrunkSearcher% & set MarkerSet=1) else (set MarkerSet=0)
if not exist %TrunkSearcher% goto NoTrunk
set HighestRev=0
for %%R in (%TrunkSearcher%) do call :CompareRev %%R
set BuildTrunk=trunk-%RChar%%HighestRev%.zip
set BuildDir=build-r%HighestRev%
if %MarkerSet% == 1 ren !%BuildTrunk% %BuildTrunk%
if exist %BuildDir%\nul goto AlreadyExists
rem --- Procedure for creating the build -----------------------
echo Using trunk r%HighestRev%...
echo.
echo Cleaning up...
if exist trunk\nul rmdir /s /q trunk
echo Unpacking trunk...
unzip -q %BuildTrunk%
if errorlevel 1 goto :UnziProb
echo Doing the build process...
mkdir %BuildDir%
cd trunk
call PrepareReleaseTree.cmd ..\%BuildDir%
cd ..
echo Cleaning up afterwards...
ping -n 3 127.0.0.1 > nul
rmdir /s /q trunk
echo Finished!
goto End
rem --- Sub batch for searching latest revision ----------------
:CompareRev
set TempRev=%1
if %MarkerSet% == 1 (
if %TempRev:~7,1% == r (
set TempRChar=r
set TempRev=%TempRev:~8,-4%
) else (
set "TempRChar="
set TempRev=%TempRev:~7,-4%
)
) else (
if %TempRev:~6,1% == r (
set TempRChar=r
set TempRev=%TempRev:~7,-4%
) else (
set "TempRChar="
set TempRev=%TempRev:~6,-4%
)
)
if %TempRev% GTR %HighestRev% (
set HighestRev=%TempRev%
set RChar=%TempRChar%
)
goto :eof
rem --- Error messages with beeps ------------------------------
:NoUnzip
echo Error: The UnZip utility cannot be found on the system.
echo Aborting.
goto :End
:NoTrunk
echo There's no trunk package %TrunkSearcher% in the current directory.
echo Nothing to do.
goto :End
:AlreadyExists
echo Build r%HighestRev% already exists.
echo Nothing to do.
goto :End
:UnziProb
echo A problem occured while trying to unzip.
echo Please check the %BuildTrunk% file.
echo Aborting.
goto :End
:End
echo.
echo Press a key to quit...
pause > nul
Prerequisites
- Copy the batch file BuildLatestTrunk.cmd to the same directory, where you save all the trunk archives (and where the build directories shall be created).
- The UnZip utility by Info-ZIP (unzip.exe) must either reside in the same directory as the batch file or must be reachable via the PATH environment variable.
Info-ZIP homepage: http://infozip.sourceforge.net/
Binary download: ftp://ftp.info-zip.org/pub/infozip/win32/
Note: Starting with r41, unzip.exe is contained in the trunk. So you can extract/copy the binary from there.
Just start the batch file BuildLatestTrunk.cmd without any parameters.
It takes the latest revision from the trunk archives residing in the current directory (trunk-r*.zip), unpacks it, and runs the build routine PrepareReleaseTree.cmd contained in the trunk archive. Voilà: You've got the ready to use files in a build directory corresponding to the trunk archive (e.g. build-r123).
Bonus feature
![Ausruf :!:](./images/smilies/icon_exclaim.gif)
Hope it makes life a little bit more comfortable. Here it does.
![Fetzig 8-)](./images/smilies/icon_cool.gif)
Greetings
Gerby