Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 26th June 2008, 17:24   #1
msureshkr
Junior Member
 
Join Date: Jun 2008
Posts: 9
nsis installer with dev/qa/prod config settings

Hi,
After successful install, I would like to launch an url but I don't want to hard code the production url inside the installer.
Is there a way we can have a external config file where nsis can read during the installation?
Thanks
Suresh M
msureshkr is offline   Reply With Quote
Old 26th June 2008, 18:00   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Yes of course. Use ReadINIStr, ConfigRead or FileRead etc

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 26th June 2008, 18:08   #3
msureshkr
Junior Member
 
Join Date: Jun 2008
Posts: 9
Thanks for your reply. So, I have to deploy the config file as part of the installer and read the settings on successful installation, right?
I also launch an url on end of uninstall or install failed, in this case we may not have the config file. How to handle this?
thanks again
Suresh M
msureshkr is offline   Reply With Quote
Old 26th June 2008, 18:28   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Quote:
I also launch an url on end of uninstall or install failed, in this case we may not have the config file. How to handle this?
Use functions un.onUninstSuccess and .onUserAbort/.onInstFailed respectively .

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 26th June 2008, 18:34   #5
msureshkr
Junior Member
 
Join Date: Jun 2008
Posts: 9
Thanks Red Wine. That was not my question, I already do that. My question is if config file gets removed during uninstall or failed to install, how can I use ConfigRead?
msureshkr is offline   Reply With Quote
Old 26th June 2008, 18:48   #6
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
The url could be stored in a definition I guess, I can't see the point of reading the url from an external file.
Anyway, simply exclude the config.cfg or whatever is the name from the uninstall list.

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 26th June 2008, 20:06   #7
msureshkr
Junior Member
 
Join Date: Jun 2008
Posts: 9
ok may be I didnt explain it well. Let me try again.
I create an installer with the url defined in the installer script, say http://qa.server.com.
QA team tests the installer and wants to deploy to production. Instead of creating the installer again with the production url "http://prod.server.com", we want to release the installer tested in qa (thats what we should do, right)
Thats why I want to externalize the config settings out of the installer, so we can deploy in various stages (qa, staging, production) etc.,
I am not sure I understand config.cfg, if you could send me any documentation, I would appreciate it.
thanks a lot
msureshkr is offline   Reply With Quote
Old 26th June 2008, 20:48   #8
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Config.cfg is just a random name for the external configuration file.
So, you could also copy it into $PLUGINSDIR as first action of the installer/uninstaller and read the values from there.

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 26th June 2008, 20:52   #9
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 644
Well, you can either have the URL hardcoded in your installer or you can load it from an external file at runtime. In the latter case your installer will depend on the external file. So it will fail if the external file was deleted, moved, renamed or never installed. The only way to overcome this dependency (and of course the preferred way) is having the URL hardcoded in the installer itself. So the best way is having the URL implemented as a define in your installer script and passing it via commandline to the MakeNSIS compiler. After your QA team has verified your installer, you re-compile that installer with the 100% identical install script. So they won't have to re-validate it. You only change the URL passed to the compiler via commandline...

code:
!ifndef MY_URL
!error "URL not specified, aborting compilation!"
!endif

...

Section MySection
ExecShell "open" "${MY_URL}"
SectionEnd


My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 26th June 2008, 20:59   #10
msureshkr
Junior Member
 
Join Date: Jun 2008
Posts: 9
Thanks guys.
Lord_Mulder,
It makes sense to have url encoded in the installer. I do agree with you about the external file dependency. I will implement the recompiling command line options.
msureshkr is offline   Reply With Quote
Old 26th June 2008, 22:08   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Pass it via command-line like so:

makensis /DMY_URL="http://..." script.nsi

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 27th June 2008, 21:56   #12
msureshkr
Junior Member
 
Join Date: Jun 2008
Posts: 9
Thanks Afrow.
msureshkr is offline   Reply With Quote
Reply
Go Back   Winamp 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