tags:

views:

172

answers:

1

Heya,

I'm trying to modify an existing NSIS install script to allow for different licence files to be presented to the user depending on whether they are a new or existing user. I have pre-existing code which detects an existing install in the .onInit section.

However I'm running into bumps trying to use the NSIS provided licence screen e.g.

!InsertMacro MUI_PAGE_LICENSE Content\Licence.rtf

I would like to be able to choose between Licence and Licence2.rtf (though they'll be renamed something representative in the final version).

I've tried using selectable sections calling functions which nest the !insertmacro but that doesn't work because it needs to be in the base level of the script.

I can't change the parameter to be runtime definable because it needs to know what the file is at compile time to build it into the installer.

I know I can roll my own custom page called from a function and do it that way but I was wondering if anyone had got the NSIS installer working with using the MUI_PAGE_LICENSE and different licences.

Thanks

+2  A: 

There are two ways to skin this cat:

  • Use 2 license pages and skip one of them
  • Load the license file manually 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 some code that does this using the system plugin, you can find that on the nsis forum. To use that code, you would include your license files with normal File commands and extract the one you want to $pluginsdir and load it in the license page's show callback function.

Anders