Archive: Section / SectionGroup order of execution


Section / SectionGroup order of execution
Hi There,

I was wondering if there was a way to override the Section or SectionGroup order of execution without re-arranging things. From what I have seen and read, Sections are executed in the order they appear in the script.

Here's a long-winded description of whats going on - in case my above question isnt clear:

I have a script that sets up a queue of pages like this: (I oversimplified the following to save space)
------------------------------------------
Page components
Page directory ; window to select main install dir
Page directory ; window to select secondary install dir
Page instfiles
------------------------------------------

Then I setup my SectionGroups and Sections like this:
------------------------------------------
SectionGroup "base components"
Section "base config files"
SectionEnd
Section "base cgi scripts"
SectionEnd
Section "base fast-cgi scripts"
SectionEnd
SectionGroupEnd
SectionGroup "3rd party components"
Section "apache webserver"
SectionEnd
Section "activeperl"
SectionEnd
SectionGroupEnd
------------------------------------------

Based on this configuration, what happens is:
- User selects components
*if any base compoents were selected:
- install base components
*if any 3rd party components were selected:
- install 3rd party components
Finish


What I want to happen is:
- User selects components
*if any 3rd party components were selected:
- install 3rd party components
*if any base components were selected:
- prompt user to select target dirs for each selection
- install base components
- Finish


I am pretty sure puting the 3rd Party selection group above the base component group would do this ... BUT I really want the base components at the top of the select list.

Thanks,
Nick


I found this thread after a little searching:
http://forums.winamp.com/showthread....=section+order

I'm not sure I completely get what is being described here and if I do, I was kind of hoping there was a cleaner way to do this in NSIS, since its almost the exact kluge that innoSetup relies on to accomplish this and the reason I came to NSIS. I really like NSIS btw - the eclipse plugin is very nice!

So anyway, if I understand what was being said, I strip out all of the executing code from my sections and replace them with code that sets flags so I know if that section was selected.

I then create a hidden section that executes last, inside of which I evaluate each flag and conditionally run the code I originally had in the sections themselves.

Is that the cleanest solution possible?

Thanks in advance!

Nick


Ok...I tried to implement the flags idea...and it looks like I couldnt do it on my own...im not so sure the flags suggestion will work, at least the way currently I understand it.

My best guess is that Page instfiles is what is controlling the 'when' of things. I'll keep reading and checking back here to see if anybody has some advice for me.

Thanks,
Nick


I found a solution - part of the problem was my oversight of something pretty obvious: my particular problem ended up having nothing to do with the order of sections and sectiongroups and everything to do with pages.

I solved my particular issue by registering a callback for leave_function with the components page. In the callback I extract and install the 3rd party components, if any were selected.

Kinda ugly but at least it works.

Nick