Vukashin
8th July 2009 16:44 UTC
Silent installer aborts without obvious reason
Hi all, I've recently, for the first time, started working on an installer using NSIS. I've managed to create installer but I have problem when I try to start it from the command line (silent install).
I know, I have to put /S to be able to install it silently. I'm using this function:
${GetOptions}
for getting command line parameters.
Problem is that all of a sudden installer aborts on this line:
StrCmp "" $0 +1 +2
Here is a part of the code:
${GetOptions} $R0 /PASSWORD= $0
StrCpy $password $0
StrCmp $password "" +1 +2
${LogText} "Password is not specified."
continue:
${GetOptions} $R0 /WINACC= $0
${LogText} "win acc: $0"
StrCpy $accountName $0
${LogText} "win acc2: $accountName"
${LogText} "win acc again1: $0"
StrCmp "" $0 +1 +2 ; this is the line where it aborts
${LogText} "Windows account is not specified."
${LogText} "after win acc"
Before this point, I also have this function called:
${GetParameters} $R0
Strange thing is that I have called StrCmp function couple of times before this.
Function
${LogText}
is used for logging.
I have put so many LogText statements for debugging reasons. All the code I wrote here is located in .onInit function. I don't know if that means something.
I'm really confused what is wrong here, if anyone knows what is the problem, please tell me. If you want more detail fill free to ask.
Afrow UK
8th July 2009 17:05 UTC
Your logic is messed up to start with. Even if you don't specify a password your script will print a message and then continue! Use LogicLib and if needed call Abort.
Stu
Vukashin
8th July 2009 17:47 UTC
Actually, this is what I did, I deliberately altered code like this because I didn't wanted to Abort. That is why I changed Abort calls on lines 4 and 12 with ${LogText} calls. And instead of jumping on label continue I made a relative jump +2. That is, now I don't abort on mistake but rather log it. Problem is that on the line which I marked with comment, installer script aborts, without any reason logical to me.
Afrow UK
8th July 2009 17:53 UTC
Could you produce a script that reproduces the problem?
Stu
Vukashin
8th July 2009 17:59 UTC
No. Actually, I have two other similar scripts (almost the same) and they are working flawlessly. That's why I am so confused. I think problem is hidden somewhere in this script, but I just can't find it. To create all these scripts I used wizard from the NSIS plug-in for Eclipse. I created a MUI2 installer, if that is important. I just thought that someone maybe had similar problem. I don't have that script with me now, but I'll attach it tomorrow. Maybe you or someone else can spot the error.
BTW, thanks for quick replay.
demiller9
8th July 2009 20:37 UTC
Macros do not count as a single line. If your macro LogText has multiple lines then this
StrCmp "" $0 +1 +2
${LogText} "Windows account is not specified."
will be jumping someplace inside the macro. You should either use LogicLib or add specific labels and put those on the StrCmp. LogicLib would really be a better choice, in my opinion.
${If} $0 == ""
${LogText} "Windows account is not specified."
${EndIf}
Don
Vukashin
8th July 2009 21:29 UTC
Hmmm... That sounds interesting. I'll try it tomorrow. Thank you, too.
Vukashin
13th July 2009 11:14 UTC
Sorry for late reply, demiller9, you were right, macros were my problem. I've solved it, thanks to you and Afrow UK.