Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSIS pages and sections execution

Tags:

sections

nsis

probably I am not getting basics of pages and sections in nsis script.

I have to analyse installation script which was not made by me. In the top of the script there are macros of MUI pages for example

!insertmacro MUI_PAGE_LICENSE $(license)
!insertmacro MUI_PAGE_INSTFILES ....

And then further down the code there are sections

Section "MainSection" SEC01

  SetShellVarContext current

  SetOutPath "$INSTDIR"
  SetOverwrite ifnewer
  File "${xy_TEMP_SRC}\InstallSrc\xy.exe"
  File "${xy_TEMP_SRC}\InstallSrc\xy.exe.config"

  SetOutPath "$INSTDIR\sk"
  File "${xy_TEMP_SRC}\InstallSrc\sk\xy.resources.dll"

  SetOutPath "$INSTDIR"

  CreateDirectory "$SMPROGRAMS\xy"
  CreateShortCut "$SMPROGRAMS\xy\xy.lnk" "$INSTDIR\xy.exe"
  CreateShortCut "$DESKTOP\xy.lnk" "$INSTDIR\xy.exe"

SectionEnd  
+ another sections for instance unninstall section

My question is how and when the sections are executed when there is no reference from pages to the sections.

My brain is telling me that the sections should be executed sometimes during the pages confirmation during the installation process, but I guess it's wrong, so please can anyone tell me how it actualy works?

like image 440
marek_lani Avatar asked Mar 08 '13 12:03

marek_lani


People also ask

What is a section in NSIS?

A block of commands "executed in order by the resulting installer." "If [Attribute] ComponentText is set, the user will have the option of disabling/enabling each visible section. If a section's name is 'Uninstall' or is prefixed with 'un. ', it's an uninstaller section."

What is a NSIS script?

Nullsoft Scriptable Install System (NSIS) is a script-driven installer authoring tool for Microsoft Windows backed by Nullsoft, the creators of Winamp. NSIS is released under a combination of free software licenses, primarily the zlib license.

How to compile NSIS script?

To compile you can right-click your . nsi file and select Compile NSIS Script. This will cause MakeNSISW, the NSIS Compiler Interface, to launch and call MakeNSIS to compile your script.


2 Answers

All sections are executed on the instfiles page and in the order of your sections. If you need stuff to be executed before, after or in between, you can use functions (e.g. pre- or leave functions)

like image 139
idleberg Avatar answered Sep 27 '22 19:09

idleberg


!insertmacro MUI_PAGE_INSTFILES Execute the sections.

like image 23
Francisco R Avatar answered Sep 27 '22 18:09

Francisco R