NSIS 安装程序 - 显示不同的许可证 [英] NSIS Installer - Displaying different licences

查看:62
本文介绍了NSIS 安装程序 - 显示不同的许可证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试修改现有的 NSIS 安装脚本,以允许根据用户是新用户还是现有用户向其显示不同的许可证文件.我有预先存在的代码,可以检测 .onInit 部分中的现有安装.

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.

但是,我在尝试使用 NSIS 提供的许可证屏幕时遇到了障碍,例如

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

!InsertMacro MUI_PAGE_LICENSE Content\Licence.rtf

我希望能够在 License 和 Licence2.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).

我曾尝试使用可选部分调用嵌套 !insertmacro 的函数,但这不起作用,因为它需要位于脚本的基本级别.

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.

我知道我可以滚动从函数调用的我自己的自定义页面并这样做,但我想知道是否有人让 NSIS 安装程序使用 MUI_PAGE_LICENSE 和不同的许可证.

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.

谢谢

推荐答案

给这只猫剥皮有两种方法:

There are two ways to skin this cat:

  • 使用 2 个许可页面并跳过其中一个
  • 在运行时手动加载许可文件
!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

手动加载:

有一个 plugin 可以为您执行此操作(不确定它是否支持 RTF)

Manual load:

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

我使用系统插件编写了一些代码,您可以找到在 nsis 论坛上.要使用该代码,您需要使用普通的 File 命令包含您的许可证文件,并将您想要的文件提取到 $pluginsdir 并将其加载到许可证页面的显示回调函数中.

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.

这篇关于NSIS 安装程序 - 显示不同的许可证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆