2 SETLOCAL ENABLEDELAYEDEXPANSION
\r
5 rem recheck whether we need to re-download
\r
6 certUtil -hashfile download.txt sha256 > lastrun.tmp
\r
7 fc /C lastrun.tmp lastrun.txt || (
\r
9 move lastrun.tmp lastrun.txt
\r
14 rem do the download and checks
\r
15 for /F "tokens=1-3" %%a in (download.txt) do (
\r
17 if "%needsupdate%"=="1" del "%%b"
\r
18 if not exist "%%b" (
\r
19 set LOCALFILENAME="%%b.tmp"
\r
21 curl --fail-early --output !LOCALFILENAME! "%%a" || (
\r
22 echo "Download of %%a failed."
\r
26 set LOCALFILENAME="%%b"
\r
28 if not exist !LOCALFILENAME! (
\r
29 echo "File !LOCALFILENAME! is missing."
\r
32 if "%%c"=="" goto error
\r
33 certUtil -hashfile !LOCALFILENAME! sha256 | findstr /I %%c > findstroutput.tmp
\r
34 echo %%c> wantedhash.tmp
\r
35 fc /C wantedhash.tmp findstroutput.tmp && (
\r
36 if NOT !LOCALFILENAME!=="%%b" move "!LOCALFILENAME!" "%%b"
\r
37 del findstroutput.tmp wantedhash.tmp
\r
39 echo "Invalid hash for !LOCALFILENAME! found!"
\r
40 del !LOCALFILENAME! findstroutput.tmp wantedhash.tmp
\r