deanbayley
18th February 2010 16:31 UTC
Creating Multiple Installers At Compile Time
Hi guys..
Can NSIS create multiple installers at compile time, i want it to create:
- Product_Name_2000-XP_SP2.exe
- Product_Name_XP_SP3_Vista-7.exe
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.
MSG
19th February 2010 08:56 UTC
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.
jpderuiter
19th February 2010 13:35 UTC
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.
rsvargas
19th February 2010 14:22 UTC
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.
ssssss
11th March 2010 09:44 UTC
rsvargas
It's a good solution, but there's one mistake (misprint). Must be:
!if ${INSTALL_TYPE} == "TYPE_FULL"
...
!endif
Afrow UK
11th March 2010 12:00 UTC
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