The documentation for DownloadTemporaryFile
says this about the RequiredSHA256OfFile
parameter:
If
RequiredSHA256OfFile
is set it will compare this to the SHA-256 of the downloaded file and raise an exception if the hashes don't match.An exception will be raised if there was an error. Otherwise, returns the number of bytes downloaded. Returns 0 if
RequiredSHA256OfFile
is set and the file was already downloaded.
From the answer here I have determined that the correct commandline method to obtain the checksum is:
CertUtil -hashfile MSAHelpDocumentationSetup.exe SHA256
This is how I add adding this particular file to my script:
AddFileForDownload('{#HelpDocSetupURL}', 'HelpDocSetup.exe');
Which expands to:
procedure AddFileForDownload(Url, FileName: string);
begin
DownloadPage.Add(Url, FileName, '');
FilesToDownload := FilesToDownload + ' ' + ExtractFileName(FileName) + #13#10;
Log('File to download: ' + Url);
end;
Is there way to automate:
- Obtaining the checksum for my file.
- Caching that checksum into a string.
- Using that checksum value when building the script.
By automating this task it will provide two benefits:
- Minimize user error in copy /pasting the checksum value.
- Keep the checksum update to date without user interaction.
Is this feasible in Inno Setup with Pascal Script?