Can I implement a custom rollback that does...? - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

catsaremyfriends
Posts: 33
Joined: Thu Mar 26, 2009 9:21 pm

Can I implement a custom rollback that does...?

First an explanation and then some questions...

My installation consists of a number of exe & dll files, a data file and one installed Windows service.

I would like the installer to do the following if my product is already installed on the target machine:

Before doing the install...
- copy the folder with the existing exe/dll's and data file to a backup folder.

If the install fails then I would like the rollback action to...
- restore the exe/dll's & data file from the backup folder
- stop and remove the installed Windows service
- reinstall & start the Windows service (using an exe in the installation folder)

Questions
========
1) Do I have to write custom actions to accomplish the above? And if so is it possible to do this (some tips would be helpful)?
2) Are there disadantages to managing the rollback this way?
3) Is there a better way?

Thanks,

cats
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Can I implement a custom rollback that does...?

Hi,

When launching a package which is already installed, it will automatically enter maintenance mode (Modify, Repair and Remove options). Also, when running a newer version of the package on a machine which has an older version installed, the older version is uninstalled automatically. Therefore, the scenario you mentioned is not encountered very often. We recommend using the automated upgrade feature.
copy the folder with the existing exe/dll's and data file to a backup folder.
restore the exe/dll's & data file from the backup folder
This could be done through a custom action. The User Guide contains the Preserve file on install how-to which may help you.
- stop and remove the installed Windows service
- reinstall & start the Windows service (using an exe in the installation folder)
Usually this is done through Service Control Operations. However, since you want to do this during rollback a custom action is required.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
catsaremyfriends
Posts: 33
Joined: Thu Mar 26, 2009 9:21 pm

Re: Can I implement a custom rollback that does...?

Let me retry the previous post by asking more general questions...

Assume that our customer already has a working version of our product on their system. If they download and install a new version of our product and for some reason that installation fails, can they be automatically be rolled back to the previous version? Or, must they download an re-install the older version.

Our update would potentially include changes to the following:
1) Executables
2) Windows Services
3) Changes to their database structure.

#3 is a real concern to us because it implies a change to their live data and a re-install of our product would mean a loss of that data.

I'm a bit new to the installer world so pardon me if this sounds a bit dumb.

Thanks,

cats
Last edited by catsaremyfriends on Fri Mar 27, 2009 10:21 pm, edited 1 time in total.
dms
Posts: 164
Joined: Tue Aug 28, 2007 7:11 am
Location: UK

Re: Can I implement a custom rollback that does...?

Hi

I'm not going to try and answer the first two points but the third is something that I have had to grapple with so I'll at least offer my thoughts on the subject and you are then free to decide what to do yourself.

My applications tend to be datacentric and new versions will either implement revisions to the gui, revisions(well to be technically accurate additions to the schema) of the underlying database or a mixture of the two. I will NEVER remove or fundamentally change tables once they are out in the big wide world. So in the circumstances that you are talking about (a rollback to the previous version) there would, or at least there should not be any data to lose. So assuming that you have an sql script that adds structure to the database then you would only require a script to reverse it in the event of failure. However Ask yourself the following . If you are adding for example some new tables, views stored procedures and are not fundamentally changing existing relationships then would you necessarily need to change the database back. After all the new additions to the underlying structure can presumably only be used by the new addions to the program. Given that its installation has failed will your end user even know the underlying data structure has changed?

Ok just a thought, and if it were me I would personally reverse the changes. I appreciate that this probably doesn't really answer your main question but it might at least give you the odd idea.

Dom
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Can I implement a custom rollback that does...?

Hi,
catsaremyfriends wrote:If they download and install a new version of our product and for some reason that installation fails, can they be automatically be rolled back to the previous version?
This depends on when the upgrade fails. For major upgrades the new version will automatically uninstall the old version before it install starts. There are two possible cases:
1) The uninstall of the old version fails. In this case the upgrade is canceled and the old version is restored.
2) The old version is uninstalled and the install of the new version fails. In this case the user will not have any version of the application installed.
dms wrote:So assuming that you have an sql script that adds structure to the database then you would only require a script to reverse it in the event of failure.
This is correct, a script can be scheduled during rollback. However this is usually done when the database is present on the machine during the package install.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”