Archive: Silent installer problem


Silent installer problem (some functions not executed)
Hi all,
my installer works great so far, but now I tried how it behaves when using /S on the commandline.
Everything is installed, but some additional functions seem to be ignored. Looks like

Section
SetShellVarContext all
SetOutPath "$PLUGINSDIR"
File bar.exe
SectionEnd

Section "foo" xyz
SetShellVarContext all
SetOutPath "$CfgDir"
File /r ...
Call CustomizeConfiguration
SectionEnd

...

Function CustomizeConfiguration
SetOutPath "$PLUGINSDIR"
ClearErrors
DetailPrint "Configuration"
nsExec::ExecToStack '"$PLUGINSDIR/bar.exe" "$CfgDir/..."'
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION "Problem"
${EndIf}
FunctionEnd

So what this basically does is install a file and afterwards do a customization of the file using bar.exe which is temporarily unpacked into $PLUGINSDIR. In non-silent mode it works but when running the installer with /S I see the original file in the end without customization.
Any idea why the nsExec::ExecToStack line is not executed when using /S ?


Does $cfgdir contain a correct value when running silent? If it's entered by the user...


Yes, $CfgDir is set. Precisely I should have said I'm using /S /INIFILE=... and I also verified (in non-silent mode) that /INIFILE works.


Have you put in some debug message boxes? (That one you will never see because nsExec will NOT set the error flag on error - you should check its exit code on the stack). Also why are you using nsExec::ExecToStack if you're not reading the output on the stack or have you just ommitted that code?

Stu


Thanks for your remarks regarding the error handling. I think I used ExecToStack because that was the only version which I managed to run without a box popping up.

I've now put some debug message boxes at the beginning and the end of the function, so I can have a look into plugins directory. With the presented code I saw that the plugins directory was missing bar.exe, so to me it looks that the sections are treated in a different order in silent mode.

But when I copy the bar.exe lines

SetShellVarContext all
SetOutPath "$PLUGINSDIR"
File bar.exe

to the beginning of the foo section, the plugin directory contains bar.exe at the beginning of my customization function, but there is still no effect of the command.
I'll add further debug messages and also debug output into bar.exe to see what's happening...


The order of sections does not change. Have you used InitPluginsDir? Also if you look at the nsExec readme, it's nsExec::Exec you want. ExecToStack does exactly that - streams the output to the stack. All nsExec calls hide console windows; that is the purpose of using nsExec.

Stu


Found the (my) bug
Ok, I'll review my nsExec usage.
And with some more debug info I also found the bug in my foo section, thanks for proposing message boxes. The shortened version presented above should indeed work.
So I should only check why my plugins directory was missing bar.exe when unpacking it within a different section, I bet it's also a bug in my script.
Thanks for your help!


The likely candidate is the plugins dir did not yet exist when you tried to extract bar.exe hence why I said to try InitPluginsDir. In a non silent install MUI will have initialized it for you. In this case it was only initialized when you called nsExec.

Stu


Indeed, that was the remaining problem.
Thanks!