Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 25th October 2012, 20:37   #1
saxe
Junior Member
 
Join Date: Oct 2012
Posts: 5
How can make NSIS to download and run a file without user intervention?

Hi there,

I am new to NSIS.

My installation would like to give the user a selection of available components and each component links to an installation from my website. When the selection is made, I would like NSIS to download the files and run them without any user intervention.

1) The checksum of these files should be verified at the end of the download against a checksum log from my website, such as a TXT file
2) These files need to be run at a certain order, not just FIFO style
3) These files should be stored in a temp directory by default so that they won't take up resource when the installation is finished
4) Before the actual download, the user can request to save these files to an user directory so that they can transfer them to another PC

Can someone be so kind to give me some pointers on how to get this done?

Thanks a lot!
saxe is offline   Reply With Quote
Old 25th October 2012, 21:36   #2
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
Hi saxe,

I'm a noob too, but some hints are better than nothing, right?

1) I saw this earlier: http://nsis.sourceforge.net/MD5_plugin
You can create the md5 checksum of a file and compare it to your text files. Reading from files is very well described in the NSIS help. To compare you can use StrCmp.

2) If the order depends on the chosen components, you can create a hidden section (that always gets executed) behind the other sections and use
code:
${If} ${SectionIsSelected} ${section_name}
...
${EndIf}


to egt some order. Requires logiclib.nsh

3) NSIS uses the temporary folder when I execute my installer, maybe it saves downloads to %temp% too? Did you check that? You can use a tool like FolderChangesView from NirSoft to do that. otherwise the constant $Temp may help.

4) You can use a custom pre-function to ask if the files should be saved right before the install page is opened. See chapter 4.5.3 Callbacks in NSIS help. Use a message box to ask the user if the files should be saved and if so let him choose a folder to save to.

Good luck
Seban is offline   Reply With Quote
Old 25th October 2012, 21:43   #3
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
1) Use the md5 plugin to create the md5 hash, and use the inetc or other download plugin to download a (text)file with the correct md5 hash in it. (Or create a php script that sends the md5hash for a requested filename.)
2) Sections are executed in the order that they appear in your .nsi script.
3) $PLUGINSDIR is your friend.
4) Create a custom page with nsDialogs, that offers the user a choice between temp or selected folder. There's an excellent tutorial in the nsDialogs readme. http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html
MSG is offline   Reply With Quote
Old 26th October 2012, 13:15   #4
saxe
Junior Member
 
Join Date: Oct 2012
Posts: 5
Thanks for the reply.

How about pointers to how to download a file from website and execute it? If codes are too much to ask, please give me a few key words so that I can use them to search this website.

I want to create a simple one to see how it works first

Again, thanks
saxe is offline   Reply With Quote
Old 26th October 2012, 14:00   #5
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
I know it's possible, but I don't know where it is written down. You could search this site http://nsis.sourceforge.net/List_of_...ring_Functions for web installtion or similar terms.
Seban is offline   Reply With Quote
Old 26th October 2012, 14:07   #6
saxe
Junior Member
 
Join Date: Oct 2012
Posts: 5
Thanks, Seban

Hopefully some guru will show us the way
saxe is offline   Reply With Quote
Old 26th October 2012, 14:17   #7
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
yw

it's a lot of searching, but most of the time the answer is somewhere to be found
Seban is offline   Reply With Quote
Old 26th October 2012, 14:28   #8
saxe
Junior Member
 
Join Date: Oct 2012
Posts: 5
I tried, but I must be using the wrong keywords.
saxe is offline   Reply With Quote
Old 26th October 2012, 14:45   #9
saxe
Junior Member
 
Join Date: Oct 2012
Posts: 5
I guess I can use the codes like this:

NSISdl::download http://www.myweb.com/support/downloads/myapp.exe localfile.exe
Pop $R0 ;Get the return value
StrCmp $R0 "success" +3
MessageBox MB_OK "Download failed: $R0"
Quit

exec localfile.exe
saxe is offline   Reply With Quote
Old 26th October 2012, 16:24   #10
Seban
Junior Member
 
Join Date: Sep 2012
Posts: 14
just stumbled upon this thread: http://forums.winamp.com/showthread.php?t=332999

maybe you can need this (didn't check it out though)
Seban 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