Archive: Silent install without /S


Silent install without /S
Hi,

I'm a user of the great NSIS and I need make installation, whitch run silently for empty command line and with dialogs for same switches on the command line. I don't know how to join SilentInstall setting with functions or sections.

Thanks for help,
HlR.


Maybe it's my problem, but I do not understand what you want to do. Please specify some more.

You want a SilentInstall and still dialogs and ComponentsPage? In my opinion, this is the contrary of a SilentInstall. But maybe I do not understand you.

Please explain!

-Hendri.


Silent install without /S
When I run my install package (made by NSIS) without command line, so I need the same behaviour as run it with /S.

In *.nsi script I need some like that (meta language :-)):

if length of $CMDLINE is 0 then
SilentInstall silent
else
SilentInstall normal

Section "" ; (default section)
SetOutPath "$INSTDIR"
...etc...

Am I clear now? :-)


If /S is specified, the installation will be silent. We do not need to program that. Apart from MessageBoxes, you will see nothing.

When you just specify "SilentInstall silent" it will be silent always, no matter what command line.

Does this answer the question?

-Hendri.


Sorry, but it isn't the answer for my problem :-(

When command line will be empty, then installation must be silent. This is my aim.


From the docs:

SilentInstall normal|
silent|
silentlog Specifies whether or not the installer should be silent. If it is 'silent' or 'silentlog', all sections are installed quietly, with no screen output from the installer itself (MessageBoxes are still displayed on error, and the script can still display whatever it wants). Note that if this is set to 'normal' and the user runs the installer with /S on the command line, it will behave as if SilentInstall 'silent' was used. Note: see also LogSet.
From my previous reply:
When you just specify "SilentInstall silent" it will be silent always, no matter what command line.
I do not see the missing part. Just try it and you will see. When "silent" is specified, it will always be silent, no matter how the commandline looks like.

-Hendri.

Sorry, its my fault. I mean: If and only if the command line is empty, instalation must be silent. If I run, for example

my_setup.exe /show

then the installation must not be silent. So, I must set SilentInstall whit dependency on the command line.


Isn't this strange? Why not use the integrated possibilities of NSIS and just use /S to make it silent. So instead of making this:

silent if CMDLINE is empty, normal else.

make this:

silent if /S, normal else.

/S is already supported and you don't need to program anymore.

You could check using GetParameters if /S is selected and depending on that display messageboxes or not.

-Hendri.


Uff :-) Yes, it's strange, but I need this functionality. I need silent install when command line is empty and non silent when command line contain my flag (or any flag), for example /a (so, I need the opposite funtionality to default behaviour).

So, I need use same function for parse command line, for example GetParameters. If command line will be equal to the string "/a" then I must set
SilentInstall silent
or
DirShow hide

When I set first
SilentInstall normal
and command line will be contain any flag, then I must set
SilentInstall silent.

But this is the problem, because this attributes can be set only out of the functions and sections and on the other hand: functions must be called from the sections.

So, this problem hasn't the solution?


Indeed: conditioning SilentInstall is not possible. Solution: change the process outside the installer. Now this process requires the installer to be silent when no commandline has been specified. ry to change this behavior so it will use the /S option. No other possibilities (except from changing the source of NSIS!).

-Hendri.


Hmm, I heard, that InstallShield can solve my problem. It's sad, but I will have to buy InstallShield software instead of I like the NSIS :-(


Do you want to spend money on that?

Maybe we could help you change the outside process that requires an installer to be run silently if it doesn't get a commandline and normally if it does get a commandline argument.

If you could alter these requirements, you could use /S.

Hey, an idea, maybe create an additional installer that turns around the commandlines and calls the true installer with the right commandline arguments (/S). This additional installer should be run silently of course.

That should work, good luck,
-Hendri.


Yes!, I had the same idea and this is my solution:

OutFile "My_Install_Package.exe"
SilentInstall normal

Function .onInit
Call GetParameters
Pop $0
StrCmp $0 "/S" end_function
StrCmp $0 "/a" end_function
Exec "My_Install_Package.exe /S"
Abort
end_function:
FunctionEnd

:-))) Everything is OK :-)))

Thanks for your patient,

HlR


Great, no InstallShield needed here :D

Greetz,
-Hendri.