Installation Result Detection and Logic using Wise Script
Hi Guys - I'll try to be as brief/specific as possible, and if there is a better/more efficient way of accomplishing my goal, suggestions are welcome!
Scenario: We use Wise Package Studio to create our installation procedures, which sometimes include multiple uninstall/install/configurations. Using these executable files, without customization, it always passes back an exit code of 0 to our deployment tool.
Goal: Develop a way to cease/desist based on exit code, and/or pass back accurately
Here is a sample of where I'm at, and where I'm stuck on the logic:
If ADBERDRVER Greater Than or Equal "10.1.0.534" then Execute %INST%\1013.msp /quiet /norestart /L*V "%LOG%\adberdr1013patch.log" (Wait) If INSTALL_RESULT Not Equal "0" then If INSTALL_RESULT Not Equal "3010" then Set Variable EXITCODE to %INSTALL_RESULT% Execute %PATH%\logemailpatch.vbs (Wait) End Call DLL %SYS%\kernel32.dll Function ExitProcess End ElseIf ADBERDRVER Less Than "10.1.0.534" then Execute msiexec.exe /i "%INST%\1010.msi" TRANSFORMS="%INST%\1010.mst" PATCH="%INST%\1013.msp" /quiet /norestart /L*V "%LOG%\adberdr1013.log" (Wait) If INSTALL_RESULT Not Equal "0" then If INSTALL_RESULT Not Equal "3010" then Set Variable EXITCODE to %INSTALL_RESULT% Execute %PATH%\logemailfull.vbs (Wait) End Call DLL %SYS%\kernel32.dll Function ExitProcess End End
During our testing, we had mixed results of laying the full 10.1.0 MSI and then the patch for 10.1.3 over previous versions, so I elected to detect the file version of acrord32.exe and then take action from there. (Note: I realize this is only one example and I'd rather not get in to patch methodology at this point, as this is just an example and can also apply to other .MSI procedures) The above process works well, but I'd like to do something like this....
Take one approach, IF INSTALL_RESULT is anything except 0 or 3010, perform action X (most likely uninstall). Then, measure result of the uninstall, if INSTALL_RESULT is 0 or 3010, perform install, then measure result, if install NOT 0 or 3010, pass back, etc.
Only way I can figure I could do this is something like...
INSTALL
IF INSTALL RESULT NOT 0
IF INSTALL_RESULT NOT 3010
UNINSTALL
IF INSTALL_RESULT = 0
OR (ElseIF?) INSTALL_RESULT=30
INSTALL
Else (not 0 or 3010) pass back to system using kernel32.dll above, and exit installation
Just seems like a mess, so I'm either thinking of this from the wrong direction or making it more complicated.
Answers (3)
I hope the code comes out OK in this post, but I would go for something along the lines of:
Set Variable _SUCCESS to FALSE
If INSTALL_RESULT equals "0"
Set Variable _SUCCESS to TRUE
ElseIf INSTALL_RESULT equals "3010"
Set Variable _SUCCESS to TRUE
End
If _SUCCESS equals TRUE
...Handle success...
Else
...Handle Failure...
End
You can easily add extra exit codes for success
Comments:
-
to clarify, if you want to do the same check again in case of failure, you'd basically use the same structure again where it says ...Handle Failure..., so set success variable to false, execute action, check exit codes and set success, execute if-branch based on value of success variable. Make sure to use a different success variable though, to keep the branches separated. - pjgeutjens 12 years ago