Archive: Creating Multiple Installers At Compile Time


Creating Multiple Installers At Compile Time
  Hi guys..

Can NSIS create multiple installers at compile time, i want it to create:


The 2000 XP one will have 2 sections missing, one section checks if the windows installer is up to date and the second installs the .NET framework v2..

My installer is 35mb and about 24mb is for the framework and windows installer v3..

I know i could make the installer download the files only if required but where my application is deployed customers often download on 1 machine and install on another...

D.

It's not really clear to me what it is you want. Do you want to make two installers? Just use two .nsi files, then.


I suppose you want to create two installers with one script.
As far as I know this is not possible.

What you can do is to put all shared code in a nsh header, and include this header into two seperate scripts with the OS specific code.


I've asked the same question once (here), and as far as I know, it is not possible.

I still needed to create two installers with one script this is what I did:

I've put the sections I needed to be on one installer but not in the other inside "!if" clauses, like this:

!if INSTALL_TYPE == "TYPE_FULL"

>Section OnlyInFull
>... ; the files that go in this section
SectionEnd
>!endif
then in the beginning of the file, I create a "!define" that can be defined optionally by the command line compiler

!ifndef INSTALL_TYPE

!define INSTALL_TYPE "TYPE_FULL"
>!endif
finally I've created a .bat file that executes the compiler two times:


makensis.exe /DINSTALL_TYPE="TYPE_FULL" script.nsi
makensis.exe /DINSTALL_TYPE="TYPE_NOT_FULL" script.nsi


actually you can call the second time without the /D option, but I've put there for clarity.

rsvargas
It's a good solution, but there's one mistake (misprint). Must be:

!if ${INSTALL_TYPE} == "TYPE_FULL"
...
!endif

In fact it really should be:

!if `${INSTALL_TYPE}` == `TYPE_FULL`
...
!endif

Notice the quotes around ${INSTALL_TYPE}. Without them, and if INSTALL_TYPE is undefined or empty, your script will not compile.

(FYI I use `` as primary quotes followed by ' and ").

Stu