Archive: Preinstaller


Preinstaller
I would like to write preinstaller which will contain all my files, extract them when executed and in the end execute pointed installer.
The problem is that my install folder contains many files and other folders and I don’t want to point all the files in nsis script of preinstaller. Do you have any idea haw to write such preinstaller and point only whole folder do compress. Perhaps there are better tools to do this – if you have any idea please let me know.
Thanks for your time
Kzchris


I had a hard time following you, but, if I understand this correctly:
"The problem is that my install folder contains many files and other folders and I don’t want to point all the files in nsis script of preinstaller"

Then instead of this:


SetOutPath "$INSTDIR\folder1"
File "source\folder1\file1"
File "source\folder1\file2"
File "source\folder1\file3"

SetOutPath "$INSTDIR\folder2"
File "source\folder2\file1"
File "source\folder2\file2"
File "source\folder2\file3"

You want to make your life easier and do something like this:

SetOutPath "$INSTDIR"
File /r "source\*.*"

This will take all the folders and files under the source subdirectory and extract them to the $INSTDIR, preserving directory structure. So you just make your file structure the same as the destination. I also sub divide my files based on sections.

So, my directory structure might look like this on my development machine:

C:\MyNSISDevelopment\Installer\MyInstaller.nsi
C:\MyNSISDevelopment\Sections\SectionAAA\ToCopy\Folder1\FileA1.txt
C:\MyNSISDevelopment\Sections\SectionAAA\ToCopy\Folder1\FileA2.txt
C:\MyNSISDevelopment\Sections\SectionAAA\ToCopy\Folder1\FileA3.txt
C:\MyNSISDevelopment\Sections\SectionAAA\ToCopy\Folder2\FileA4.txt
C:\MyNSISDevelopment\Sections\SectionAAA\ToCopy\Folder2\FileA5.txt
C:\MyNSISDevelopment\Sections\SectionAAA\ToCopy\Folder2\FileA6.txt

C:\MyNSISDevelopment\Sections\SectionBBB\ToCopy\Folder1\FileB1.txt
C:\MyNSISDevelopment\Sections\SectionBBB\ToCopy\Folder1\FileB2.txt
C:\MyNSISDevelopment\Sections\SectionBBB\ToCopy\Folder1\FileB3.txt
C:\MyNSISDevelopment\Sections\SectionBBB\ToCopy\Folder2\FileB4.txt
C:\MyNSISDevelopment\Sections\SectionBBB\ToCopy\Folder2\FileB5.txt
C:\MyNSISDevelopment\Sections\SectionBBB\ToCopy\Folder2\FileB6.txt

And my code would look like this:

Section "SectionAAA" Sec_AAA
SetOutPath "$INSTDIR"
File /r "..\Sections\SectionAAA\ToCopy\*.*"
SectionEnd
Section "SectionBBB" Sec_BBB
SetOutPath "$INSTDIR"
File /r "..\Sections\SectionBBB\ToCopy\*.*"
SectionEnd

See how simple that makes the code? It's all in how you organize your directory structure on the source machine. I make the ToCopy folder because I might have other files relevant to that section that aren't necessarily copied in that way. Everything under ToCopy is structured identically to what I want the structure to be under the destination $INSTDIR

So for the above example the code would produce this on the destination machine, if $INSTDIR = C:\Program Files\MySoftware\:

C:\Program Files\MySoftware\Folder1\FileA1.txt
C:\Program Files\MySoftware\Folder1\FileA2.txt
C:\Program Files\MySoftware\Folder1\FileA3.txt
C:\Program Files\MySoftware\Folder2\FileA4.txt
C:\Program Files\MySoftware\Folder2\FileA5.txt
C:\Program Files\MySoftware\Folder2\FileA6.txt
C:\Program Files\MySoftware\Folder1\FileB1.txt
C:\Program Files\MySoftware\Folder1\FileB2.txt
C:\Program Files\MySoftware\Folder1\FileB3.txt
C:\Program Files\MySoftware\Folder2\FileB4.txt
C:\Program Files\MySoftware\Folder2\FileB5.txt
C:\Program Files\MySoftware\Folder2\FileB6.txt

Can you define what you call a preinstaller, and also what a "pointed installer" is(an installer that's not pointless?)? At first it sounded like you wanted all the files in the preinstaller, then it sounds like you don't.

Here are a couple scripts that divide installer into multiple installers:
http://nsis.sourceforge.net/Multi-volume_Distribution

Thank You for your exhaustive answer. I must admit that I’m not strong in English and I have some difficulties in expressing thoughts in that language. However your answer and example you recommended are almost exactly this that I was looking for.
Thanks again.
KZchris


No problem. I've known English all my life, and I still have problems communicating what I mean sometimes.