2

I am trying to write an Inno Setup installer to install and then run other installers. The problem I have is when trying to install Cygwin. I have downloaded Cygwin and all packages I need so I can perform a local install. Then I want to add extra files and directories to the Cygwin installation.

My first attempt was like this:

[Files]
Source: "{#Cygwin}\Cygwin\*"; DestDir: {tmp}\cygwin; Flags: recursesubdirs;
Source: "{#Cygwin}\additional\*"; DestDir: {tmp}\cygwin\additional; Flags: recursesubdirs

[Run]
Filename: "{tmp}\cygwin\setup-x86_64.exe"; Parameters: "-q -L"; WorkingDir: "{tmp}";

But this means that I must have a script to add the additional files because there is nowhere to put them until Cygwin is actually installed by the command in the [Run] section.

I have tried using a BeforeInstall script in the [Files] section to run the Cygwin installer before adding the additional files, but because I have to use a wildcard with Source: "{#Cygwin}\additional\*"; the script is called once for every file in the directory tree.

The [Files] section of Inno Setup seems to only accept source files, and not a source directory, unless the directory has a wildcard.

Is there a way I can make it install everything from a directory tree without using a wildcard, or is there a way I can make the BeforeInstall script run just once, regardless of how many files are copied?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
johno999
  • 23
  • 3

1 Answers1

0

Install the Cygwin on the first call to BeforeInstall function only.

var
  CygwinInstalled: Boolean;

procedure MyBeforeInstall;
begin
  if CygwinInstalled then
  begin
    Log('Cygwin installed already');
  end
    else
  begin
    Log('Installing Cygwin');

    { install Cygwin here }

    CygwinInstalled := true;
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992