简体   繁体   English

使用NSIS完成主要安装部分后,显示另一个许可证页面

[英]Show another license page after finish main installation part using NSIS

So, this is my current installer page structure: 因此,这是我当前的安装程序页面结构:

!insertmacro MUI_PAGE_WELCOME
page custom CheckHWSpecs
!insertmacro MUI_PAGE_LICENSE "${SOURCEFOLDER}\CDA_update061702.txt"
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

When user finish installing the main application, I need to install a third-party application. 当用户完成安装主应用程序时,我需要安装第三方应用程序。 Before start to install the 3rd-party app, I need to show another license page and if user agree, it will continue to install the app. 在开始安装第三方应用程序之前,我需要显示另一个许可证页面,如果用户同意,它将继续安装该应用程序。 But, if user disagree, it will cancel the 3rd-party app installation and the installation process is finish. 但是,如果用户不同意,它将取消第三方应用程序的安装,安装过程完成。

Can I do something like this? 我可以做这样的事情吗?

!insertmacro MUI_PAGE_WELCOME
page custom CheckHWSpecs
!insertmacro MUI_PAGE_LICENSE "${SOURCEFOLDER}\CDA_update061702.txt"
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_LICENSE "${SOURCEFOLDER}\license2.txt"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

But if there are two !insertmacro MUI_PAGE_INSTFILES , how to make sure the 3rd-party installer will run in the second MUI_PAGE_INSTFILES? 但是,如果有两个!insertmacro MUI_PAGE_INSTFILES ,如何确保第三方安装程序将在第二个MUI_PAGE_INSTFILES中运行?

  • I would configure the 3rd -party app as another section (it can be hidden if the text is empty or by code with a SectionSetText ${SectionID} "" ). 我会将第3方应用程序配置为另一个部分(如果文本为空或使用具有SectionSetText ${SectionID} ""的代码可以隐藏)。
  • After the first licence page, use a custom page to display the 2nd license with a checkbox to accept it (IIRC you can use only one MUI_PAGE_LICENSE ) 在第一个许可证页面之后,使用自定义页面显示第二个许可证,并带有一个复选框以接受它(IIRC您只能使用一个MUI_PAGE_LICENSE
  • depending on the result of the custom page (use a custom page leave callback to test for acceptance or not), check the hidden section with !insertmacro SelectSection ${SectionID} 根据自定义页面的结果(使用自定义页面的离开回调来测试是否接受),请使用!insertmacro SelectSection ${SectionID}检查隐藏部分!insertmacro SelectSection ${SectionID}
  • then during the execution of MUI_PAGE_INSTFILES your 3rd-party app will be installed (or not) like the main app. 然后在执行MUI_PAGE_INSTFILES期间,将像主应用程序一样安装(或不安装)您的第三方应用程序。
!include Sections.nsh
!include WinMessages.nsh
ShowInstDetails show
!include MUI2.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Examples\example1.nsi"
!insertmacro MUI_PAGE_INSTFILES
!define MUI_LICENSEPAGE_CHECKBOX
!define MUI_LICENSEPAGE_CHECKBOX_TEXT "Blah blah blah app and agree..."
!define MUI_PAGE_CUSTOMFUNCTION_SHOW Lic2Show
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Examples\example2.nsi"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English

Section /o "Bonus app" SID_BONUS
DetailPrint "Installing bonus app..."
Sleep 2222
SectionEnd

Section "Main app" SID_MAIN
DetailPrint "Installing main app..."
Sleep 2222

!insertmacro SelectSection ${SID_BONUS}
!insertmacro UnselectSection ${SID_MAIN}
SectionEnd

Function Lic2Show
GetDlgItem $0 $hwndparent 2
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(MUI_BUTTONTEXT_FINISH)"
FunctionEnd

If the user does not install the extra app then you never get to the finish page, the cancel button is just renamed to "Finish". 如果用户未安装额外的应用程序,则您将永远无法进入完成页面,取消按钮仅重命名为“完成”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM