Old 17th June 2008, 14:23   #1
Sheik
Senior Member
 
Join Date: Feb 2007
Posts: 152
Defining Section Order at Runtime.

Hi all,

This issue has been a nagging one for me, for awhile.

I wonder if anyone else has found a solution to it, or perhaps a workaround?

Lets say I have an Installer that has 6-8 sections.

I want to define an order to said sections at runtime, based on what sections they select to be installed.

So perhaps if they select "all", then I have one set of orders, but if they only select 4 of 8, then I want to have a different order of Install...

Is there any way to do this?
Can I define an order of how the sections run/get installed during runtime?
Sheik is offline   Reply With Quote
Old 17th June 2008, 15:01   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Unselected sections won't get executed, where exactly is the issue that you're referring?

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 17th June 2008, 15:45   #3
Sheik
Senior Member
 
Join Date: Feb 2007
Posts: 152
Hi Red Wine,

I need the section order changed, based on what sections they decide to install.

For instance, lets say I have 4 sections:

The default order:
1) Install sub1
2) Install main.
3) Install sub2
4) Install sub3

HOWEVER, lets say that I want this order to ONLY install this way if they select all the sections to install.
But lets say I want this order to change, if they DON'T select sub2 to install.
In that case, I want this order to be changed to say:

1) Install main
2) Install sub3
3) Install sub1

This is a simplified case, I actually have 8-9 sections, all of which have certain orders they need to be installed, based on which other sections they have select/not selected...

I need a way to define the order at runtime, in which these sections are run/installed...

Scott
Sheik is offline   Reply With Quote
Old 17th June 2008, 16:40   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
I guess you should add a different order of the sections (with different section id's of course) and associate each order with a certain install type.
Makensis won't compile twice same files so the size of the installer would remain the same but you have to write a lot of complicated code.
I guess it should work as you expect though I haven't try it my self.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 18th June 2008, 04:06   #5
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
Or another idea:
Make all your current sections just an empty "shell" and install everything from one hidden section. Have the hidden section execute things in an order based on the section flags of the other sections. (use sections.nsh and logiclib.nsh to make coding easier.)

It might take you a bit to come up with the correct logic, but once you had it down, it might be easier to manage.
Comperio is offline   Reply With Quote
Old 18th June 2008, 05:20   #6
Sheik
Senior Member
 
Join Date: Feb 2007
Posts: 152
Hi all,

Yeah, Comperio, that is currently the way I was doing it... But I was really hoping to be in the "spirit" of sections, and actually install/uninstall files in their respective section namespace...

I am actually writing a new patch for NSIS right now, that hopefully kichik will accept it.

I am adding 2 new commands:
SectionSetOrder
SectionGetOrder

It adds a new flag internally to the "section struct", that allows users to specify the order of installation for each section.

By default, all sections are set to an order of 0, which means to use the regular "in order" way.
But if we come across a value for "order" that is non-zero, it will override the regular "in order" way, and will install/uninstall based on 1 -> X, where X is a bigger number.

The code itself is obviously very small, as I am just reusing a lot of existing code, mostly the SectionSetSize/SectionGetSize commands.

I have most of the patch done, and will finish it up tomorrow, as well as submit it tomorrow as well...
Sheik is offline   Reply With Quote
Old 18th June 2008, 17:43   #7
Sheik
Senior Member
 
Join Date: Feb 2007
Posts: 152
Hi all,

I have finished the patch, and submitted it to sourceforge here:
http://sourceforge.net/tracker/index...49&atid=373087

Add 2 new commands to allow defining Section Order at Runtime.

This patch allows us to define, at runtime, the order in which sections
will be installed.

I have added 2 new commands, called:
SectionSetOrder
SectionGetOrder

I have added a new int variable in the struct section, called "order".
By default, "order" for each section is set to 0, indicating no ordering
preference.

The SectionSetOrder command allows users to set the new order so you can
run section installs in a different order.

Most of this patch just uses the "SectionSetSize/SectionGetSize" code as
its guide.

I wrote this patch, specifically because I have a situation where I have 8
or 9 sections, and depending upon which sections are enabled/disabled, I
need to change the order of the way I install each section.

My topic on the NSIS Forum is here:
http://forums.winamp.com/showthread....hreadid=293244

Below is the copy/paste of the patch.
If you accept this patch, and would like a .patch file instead, let me
know.

Please consider adding this patch, thank you!
Sheik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump