Archive: Does NSIS install three or more software with one Install EXE?


Does NSIS install three or more software with one Install EXE?
  Does anyone know really well about NSIS "super Pimp" i have a tough question about this intresting install software. Could this software do multiple install with one exe? If so How and could it also access other software installers.

For example:
let say that i would put Apache, mysql, zope in to this package, could i do it. But there are other problems, How can i access those other packages's build in installer?


Sure... put Sections in your installer for each one of you
product... but...do you wanna installed ALL of them at the same time
or you wanna let the end-user to select one or everything?


It's very simple and easy to achieve.

In your nsi script you can add many sections...

eg.

Section "Install MyProgram1"
SetOutPath "$INSTDIR\MyProgram1"
File "C:\MyProgram1\*.*"
SectionEnd

This first bit will add a install option for installing 'MyProgram1'
If it is checked, then anything inside the section will run, eg.
SetOutPath (is obvious) will set the path where files will be dumped on the users' PC
$INSTDIR is the variable for the installation path that the user can enter on the NSIS 'Directory' page.
The 'File' cmd will compress the file specified off your PC into the exe, and then will allow it to be extracted to the OutPath.

You can have as many sections as you wish!


NSIS IS THE BEST!

-Stuart :)


Using NSIS for multiple Install in one installation.
  Thank you Stuart, i was looking at the Documentations for the Setoutpath and the file command. that is the least of my worries.

If i could get more specific help from this community, i would be glad to post my scrips on line to view. there really isn't much examples that i can use to look at.

My script will be long, may probably a variety of codes.

this is my first time coding Install scripts.


Aschenabachen.


Taking php application codes from C drive.
  the only way this installer will work is that i have installed php already on my pc and i lay it right under the c:\ drive. It needs to read all the dirs and files under c:\php and the NSIS installer does something to suck it all up and turn it into a executable file.

to do this you would need to type in;
makensis install.nsi
under the DOS prompt.

here is the codes that will read everything from c:\php plus all the dirs/files under php too and put it into the NSIS installer, in this case install.exe

outfile "install.exe"

; The stuff to install
Function "php"
; Install dir
; InstallDir "c:\"
; Set output path to the installation directory.
SetOutPath "C:\"
; read files from c drive and
; loaded in the exe file
File /r C:\php
FunctionEnd

i don't know the different between
installdir and $INSTDIR and $OUTDIR.

Please give me examples.

i could change my codes to be this way:

installdir "c:\"

function "php"
; install dir
;this variable referr back to ;installdir, don't know it will work or not
setoutpath "$INSTDIR"
file /r "$INSTDIR"
functionend

is this right?
Is there an easier way to do this?

aschenbachen


First you should sections insteed of functions.

Section "php"

SetOutPath "C:\PHP"
File /r "C:\PHP\*.*"
SectionEnd

With these lines all files with subdirectories from C:\PHP will be packed and installed in the Target given by SetOutPath (C:\PHP)


$OUTDIR is the directory in which files will be extracted. $INSTDIR is the installation directory chosen by the user or, if the directory page doesn't show, by InstallDir or InstallDirRegKey.

You can't use either in File because File searches for those files on compile time and not on run-time when those are defined. When compiling $INSTDIR doesn't mean a thing to the compiler, it could be anything from C:\php to Z:\MyProgs\WebDev\PHP.

There are examples in your Examples directory and more in the Archive.


continuation of Mysql, Apache, php package in Install script.
  As promised, Here is part of my script so far.

thanks everyone for explaining NSIS.

Nothing special.

[edit by kichik]please attach large scripts. attached below[/edit]

i am using a control structure to control the flow of the code, Functions are better than Sections b/c i am using a Section to control the flow of things. Functions in C/C++ are faster so...

i have a big question, Since Mysql comes in a zip file, how to i actually install this application to build in with my script to make one huge installation process?

my idea is to extract the mysql files in a folder let say c:\mysql, so that the mysql installation procedures will take over the NSIS installation procedures.

i now need to access the setup.exe, How do i access the setup.exe in NSIS script?

installing/encorporating Apache in my scripts will my next task.

asch


To extract files from a ZIP file use the ZipDLL from the archive (http://nsis.sf.net/archive - search for zipdll). To execute programs use Exec, ExecWait, ExecShell, nsExec::Exec, nsExec::ExecToLog, or nsExec::ExecToStack.

Oh, and sections are faster than functions in this case because you have to call functions from sections.


MySql and Apache install codes
  Section "install"
call apache
call mysql
SectionEnd

;Function "apache"

; this code will suck in the entire install apache application at compile time
; release it to a temp folder and execute the apache install application
; File "D:\apache\apache_1.3.27-win32-x86-no_src.exe"
; SetOutPath "c:\temp"
; ExecWait "c:\temp\apache_1.3.27-win32-x86-no_src.exe"

; As far as my concerns i am letting the script compile "without" building in the entire apache applciation
; inside the exe file, that would be one huge exe file
; this should access the install utility from the d: drive, once the user
; click on the install.exe icon.
ExecWait "D:\apache\apache_1.3.27-win32-x86-no_src.exe"

; dude this Execwait better work, b/c no matter what, you have to use this.
FunctionEnd

;the last option is to use the classes stuff
;nsExec::Exec, nsExec::ExecToLog, or nsExec::ExecToStack.
;how do you use these?

;if anyone needs this, this would be the same for mysql
; since i don't trust the extended zip.dll file, and don't know how to
; plugin to the NSIS installer, here it is, same stuff as above
Function "mysql"
; first, i am unzipping the Mysql package
; burn it on to a CD with lots of files under d:\mysql
; then i access the setup.exe application installer
ExecWait "D:\mysql\setup.exe
FunctionEnd


You don't need nsExec unless the Apache/MySQL isntaller is command line (DOS). I don't recommend assuming the CD-ROM is on drive D:. You better get the first two letters of $EXEDIR using StrCpy $0 $EXEDIR 2.


Tested codes with messagebox, copyfiles, ExecWait!
  Hello,

i tested a few things and they work well.
Unfortunately, i have hard-coded most parts. i can't seem to use the NSIS Variables, each time i tried, it won't compile.
Feel free to change my codes to suit your needs.

Can i run the installer while switching CDs? i am loading/running everything from CDs. Is it possible to pause that exe file while running?

i am sad to say that i really don't know how to check for the proper CD-ROM drive in my script if they drive letter is not 'D'. i hardcorded that in the script.

Asch


Re: Tested codes with messagebox, copyfiles, ExecWait!
 

i tested a few things and they work well.
Unfortunately, i have hard-coded most parts. i can't seem to use the NSIS Variables, each time i tried, it won't compile.
Feel free to change my codes to suit your needs.
Can you please give an example of a command that uses a variable that doesn't compile?

Can i run the installer while switching CDs? i am loading/running everything from CDs. Is it possible to pause that exe file while running?
I have never tested this but I think it should be OK. All of the code is loaded into memory so the only problem will be with extracting files. If it doesn't work you can always copy your installer to $TEMP.

i am sad to say that i really don't know how to check for the proper CD-ROM drive in my script if they drive letter is not 'D'. i hardcorded that in the script.
Well, as I said in the post above:

"You better get the first two letters of $EXEDIR using StrCpy $0 $EXEDIR 2."

Variables not work!
  hello,
The program files variable, windir variable doesn't work.


function "suckin"
File "$PROGRAMFILES\apache group\apache\htdocs\*.php"
File "$WINDIR\php.ini"
functionend

Asch


Does "File" can run inside of a "Function"?


Re: dark boy question
  Hello,

My entire coding philosophy are based in functions, everything i do is inside a function. If i write out program files, it works.
ex:
file "C:\program files\apache group\apache\*.*"

Asch


then why "$WINDIR" doesn´t work? Is the file in that directory?


re:dark boy $WINDIR
  Hello dark boy,

Did you try to make some codes up and compile any codes, i tried it inside a function, and inside a section, NONE of the variables works. I am sure they won't work outside of any sections and functions.

That is no problem, As long as typing it all out works then its fine with me.

its just strenge to me that way that i can't access these variables.

Asch


It's not the scetion or function's fault. You can't use variables with the File command. The variables are extended at run-time and are depended on the user's machine. NSIS can't tell what $WINDIR will be on the user's machine while adding the files to the installer.


Can I Encorporate MySql, Apache, Winzip installer in to the NSIS Install??
  Hello,

Is it possible to encorporate third party install with the compiled EXE file that i made?

So far i tested throughlly with winzip, but the winzip installer took over the process, which is fine,but to make it looks nicer.

Is there a solution for this task?

Asch


Use ExecWait to make NSIS wait for the installer to finish. If you want to make the other installer quite and not disturb see this page:
http://unattended.sourceforge.net/installers.html


Final Product--> MySql and Apache!!
  Hello,

My final product is finish, very simple. the actual one a little with more same functions over and over again.

As far as mysql, apache goes, i am installing them from a CD.
d:\mysql\mysql_setup.exe
d:\apache\apache_setUp.exe

i am calling the exe files from the compiled exe file i made using NSIS.

i didn't need to encorporate those apache, mysql exe files into one huge installer.

after using this for three days, this NSIS product is great, a few minors problems.

have fun changing this script.

Asch:)


Why are you still using D:? Use:

Function .onInit

StrCpy $R9 $EXEDIR 2
FunctionEnd

># then everywhere there is a D: replace with:
>CopyFiles /silent "$R9\dir\file"