Page 1 of 1

Forcing a rollback of installation

Posted: Thu Jul 14, 2011 4:25 pm
by glenharvy
Hi,

In my IA project that installs or updates (after uninstalling the program), I have IA run a program that updates a database. If the database update fails for any reason, the program will/can exit with an errorcode != 0 or perhaps create a semafore a file if necessary.

What I want to do is check the errorlevel returned by the database update program and if appropriate force the whole IA installation to to fully rollback.

I'm using IA v11.

Has anyone got some practical experience with this scenario and could they please either share their IA code or point me in the right direction to achieve this.

Thanks,

Re: Forcing a rollback of installation

Posted: Thu Jul 14, 2011 8:22 pm
by giaviv
Hi,

The best way do to this is create a batch script that writes %errorlever% to a file.
You can then call this bat script from InstallAware and read the content of the created file..

You can also create a DLL or a plugin that will get the error level and return it, but it will probably require more work.

Re: Forcing a rollback of installation

Posted: Fri Jul 15, 2011 12:32 am
by glenharvy
Hi,

Thanks for that .. it should be the easy part because I already do something similar elsewhere in IA.

The part that I need confirmation is, what variable do I have to set so that IA will stop processing and perform the full rollback.

Re: Forcing a rollback of installation

Posted: Fri Jul 15, 2011 10:14 am
by giaviv
You don't need to set any variables - you can have your batch file wait for the 3rd party program to run, and therefore InstallAware will also wait for the batch file to complete.

Re: Forcing a rollback of installation

Posted: Fri Jul 15, 2011 3:55 pm
by glenharvy
Ok - but how does IA know whether it ran successfully or not. In other words, how does IA know whether to continue with the installation or stop and perform a roll back?

Re: Forcing a rollback of installation

Posted: Sat Jul 16, 2011 11:57 am
by giaviv
You can read the error level and create an If block that rolls back and exists the installer if it is not 0.

Re: Forcing a rollback of installation

Posted: Sat Jul 16, 2011 4:11 pm
by glenharvy
giaviv wrote:You can read the error level and create an If block that rolls back and exists the installer if it is not 0.
Unless I hear otherwise, and until I test it myself, I will assume that 'Terminate Install' automatically performs a rollback of the installation so far.

Re: Forcing a rollback of installation

Posted: Sun Jul 17, 2011 10:33 pm
by giaviv
Hi,

That's not accurate - please read the MSI Transaction section in the F1 help files - it will clarify exactly how transactions work - thanks!