简体   繁体   English

Inno Setup:在安装开始前下载 setup .bin 切片文件

[英]Inno Setup: Download setup .bin slice files before installation starts

I am trying to create a distributable .exe file with Inno Setup tools and Inno Download Plugin.我正在尝试使用 Inno Setup 工具和 Inno Download Plugin 创建一个可分发的 .exe 文件。 The resulting file is ~3GB in size, split in 6 parts (1 for the executable, 5 bins containing all the files).生成的文件大小约为 3GB,分为 6 个部分(1 个用于可执行文件,5 个 bin 包含所有文件)。

Would it be possible to keep the 5 bins uploaded on some server and download them during installation with the remaining executable file?是否可以将上传的 5 个 bin 保留在某个服务器上,并在安装过程中使用剩余的可执行文件下载它们?

My code is here :我的代码在这里:

procedure InitializeWizard();
var
  ResultCode: integer;
  TempAddress: String;
  FinalSavePath: String;
  UserName, UserCompany: String;
begin
  idpSetOption('DetailedMode',  '1');
  idpSetOption('AllowContinue', '1');

  idpSetLogin('aaa', 'aaa');

  idpAddFile('https://...', target_path);
  idpAddFile('https://...', target_path);
  idpAddFile('https://...', target_path);
  idpAddFile('https://...', target_path);
  idpDownloadAfter(wpWelcome);
end;

With idpDownloadAfter(wpWelcome) the installer starts downloading right after accepting to run the executable, if .bin files are already present.使用idpDownloadAfter(wpWelcome)安装程序在接受运行可执行文件后立即开始下载,如果.bin文件已经存在。 If not, the installer just keeps asking for the .bin to be present.如果没有,安装程序只会不断要求.bin存在。

Inno Setup 6.1 has a built-in support for file downloads, which does not need any support files. Inno Setup 6.1 内置了对文件下载的支持,不需要任何支持文件。 So the solution below is obsolete now.所以下面的解决方案现在已经过时了。 See Inno Setup: Install file from Internet .请参阅Inno Setup:从 Internet 安装文件


Inno Download Plugin uses idp.dll , which itself is stored in the mysetup-*.bin files. Inno Download Plugin 使用idp.dll ,它本身存储在mysetup-*.bin文件中。 That's why you get prompted for the .bin files, even before anything starts.这就是为什么在任何事情开始之前都会提示您输入.bin文件的原因。 You need the idp.dll so that the download itself can start.您需要idp.dll以便下载本身可以开始。

With some hacking you can have the idp.dll be stored in the [Code] , hence directly in the mysetup.exe .通过一些黑客攻击,您可以将idp.dll存储在[Code] ,因此直接存储在mysetup.exe
See Inno Setup: Reading a file from installer during uninstallation .请参阅Inno Setup:在卸载期间从安装程序读取文件

You will need to modify the idp.iss as follows:您需要按如下方式修改idp.iss

  • Remove the [Files] section with its reference to idp.dll .删除[Files]部分及其对idp.dll引用。
  • In all the external functions declarations:在所有external函数声明中:
    change @files:idp.dll cdecl to @{tmp}\\idp.dll cdecl delayload .@files:idp.dll cdecl更改为@{tmp}\\idp.dll cdecl delayload

To the front of your .iss script, copy the long code block from my answer to the previously mentioned question ..iss脚本的前面,复制我对前面提到的问题的回答中的长代码块。

And now you can do:现在你可以这样做:

procedure InitializeWizard();
begin
  SaveBinaryStringToFile(
    ExpandConstant('{tmp}\idp.dll'), {#FileToBinaryString("unicode\idp.dll")});

  idpAddFile(
    'https://www.example.com/mysetup-1.bin', ExpandConstant('{src}\mysetup-1.bin'));

  idpDownloadAfter( {whatever} );
end;

Make sure you update the path to the idp.dll to the correct location on your development machine in the call to FileToBinaryString .确保在调用FileToBinaryStringidp.dll的路径更新到开发机器上的正确位置。

The code is for Unicode version of Inno Setup (the only version as of Inno Setup 6).该代码用于Inno Setup 的 Unicode 版本(Inno Setup 6 的唯一版本)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM