NSIS Installer - Display Different Licenses

I am trying to modify an existing installation of NSIS script to provide the user with different license files depending on whether they are a new or existing user. I have pre-existing code that detects an existing installation in a .onInit section.

However, I encounter bumps when trying to use the NSIS license screen, for example.

!InsertMacro MUI_PAGE_LICENSE Content\Licence.rtf 

I would like to be able to choose between License and License2.rtf (although in the final version they will be renamed to something representative).

I tried using selectable sections calling functions that insert! insertmacro, but this does not work, because it must be at a basic script level.

I cannot change the parameter for determining the runtime, because he needs to know that the file is at compile time in order to install it in the installer.

I know that I can collapse my own page called from a function and do it this way, but I was wondering if anyone had an NSIS installer working using MUI_PAGE_LICENSE and different licenses.

thanks

+6
nsis
source share
2 answers

There are two ways to hide this cat:

  • Use 2 license pages and skip one of them.
  • Manually download the license file at run time

Two pages:

 !define MUI_PAGE_CUSTOMFUNCTION_PRE skip1 !InsertMacro MUI_PAGE_LICENSE Content\Licence.rtf !define MUI_PAGE_CUSTOMFUNCTION_PRE skip2 !InsertMacro MUI_PAGE_LICENSE Content\Licence2.rtf #You need two functions skip1 and skip2, they should call `abort` to skip based on some state you determine at run-time 

Manual load:

There is a plugin that does this for you (not sure if it supports RTF)

I wrote code that does this with a system plugin, you can find

+8
source share

There is an easier way. I am using this code:

 !insertmacro MUI_PAGE_LICENSE $(MUILicense) 

In addition, you must enter your lines of code as follows:

 LicenseLangString MUILicense ${LANG_POLISH} "SomeDirectory\licencja_pl.txt" LicenseLangString MUILicense ${LANG_ENGLISH} "SomeDirectory\license_en.txt" 

They should not appear before inserting a licensed macro. In my code, I defined them just below, and it works great.

+6
source share

All Articles