NSIS无人值守选项
我想构建一个NSIS脚本,它有三个部分NSIS无人值守选项,nsis,unattended-processing,Nsis,Unattended Processing,我想构建一个NSIS脚本,它有三个部分 主要部分 小调 部分共享 “共享”是不可见的,如果选中了“主”或“次”选项,则将安装它。如果启动安装程序,将检查每个部分(主要部分、次要部分) 现在,它应该能够定义该部分(在静默安装中)。我要更改什么,只安装主或次或同时安装两者?您应该查看文档的部分,特别是更改章节选择的部分 另外,这个例子可能会有用 Name "Test" Outfile "Test.exe" ;RequestExecutionLevel ? !include "Sections.
- 主要部分
- 小调
- 部分共享
Name "Test"
Outfile "Test.exe"
;RequestExecutionLevel ?
!include "Sections.nsh"
!include "LogicLib.nsh"
!include "FileFunc.nsh" ;For GetOptions
Page Components "" "" EnforceSectionDependencies
Page InstFiles
Section /o "Main" SID_MAIN
DetailPrint Main
SectionEnd
Section /o "Minor" SID_MINOR
DetailPrint Minor
SectionEnd
Section "" SID_SHARED
DetailPrint Shared
SectionEnd
!macro CheckSectionSwitch sw sid
${GetOptions} $0 '${sw}' $9
${IfNot} ${Errors}
StrCpy $1 1
!insertmacro SelectSection ${sid}
${EndIf}
!macroend
Function .onInit
${GetParameters} $0
StrCpy $1 0 ;Any section swithes?
ClearErrors
!insertmacro CheckSectionSwitch '/Main' ${SID_MAIN}
!insertmacro CheckSectionSwitch '/Minor' ${SID_MINOR}
${If} $1 = 0
;Set defaults
!insertmacro SelectSection ${SID_MAIN}
!insertmacro SelectSection ${SID_MINOR}
${EndIf}
call EnforceSectionDependencies
FunctionEnd
Function EnforceSectionDependencies
!insertmacro UnselectSection ${SID_SHARED}
${If} ${SectionIsSelected} ${SID_MAIN}
${OrIf} ${SectionIsSelected} ${SID_MINOR}
!insertmacro SelectSection ${SID_SHARED}
${EndIf}
FunctionEnd