Forcing a rollback of installation

Got a problem you cannot solve? Try here.
Post Reply
glenharvy
Posts: 167
Joined: Fri Sep 14, 2007 3:53 am

Forcing a rollback of installation

Post 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,
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Forcing a rollback of installation

Post 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.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
glenharvy
Posts: 167
Joined: Fri Sep 14, 2007 3:53 am

Re: Forcing a rollback of installation

Post 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.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Forcing a rollback of installation

Post 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.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
glenharvy
Posts: 167
Joined: Fri Sep 14, 2007 3:53 am

Re: Forcing a rollback of installation

Post 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?
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Forcing a rollback of installation

Post 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.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
glenharvy
Posts: 167
Joined: Fri Sep 14, 2007 3:53 am

Re: Forcing a rollback of installation

Post 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.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Forcing a rollback of installation

Post 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!
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply