Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install4j - is there any finalization stage option in case of a failure?

Tags:

java

install4j

We are using Install4j 6.1.6. On the installer, one of the failure strategies action options is Quit on failure.

When marking the option, the installer will try to roll-back previous changes, but won't always be able to. An example for that scenario is when the installer installs a window service, but it won't be able to uninstall it properly by the roll-back in case of a failure later on.

Is there any way defining a 'finally' step, in which I can define what should happens in case if a failure?

EDIT: I know there is a "Rollback executable" property on the "Run executable or batch file" action, but it still won't resolve my problem, since I have many actions which could fail after the service installation. Is there any way defining such a property on a batch of actions?

like image 349
Nimrod Avatar asked Dec 07 '25 17:12

Nimrod


1 Answers

There are no action blocks that run in case of a rollback.

The best option may be to use "Run script" actions that have just true as their script and use their "Optional Rollback Script" property to perform cleanup.

If you need the functionality of actions in the rollback code, you can instantiate the actions and execute them programmatically, like this:

import com.install4j.runtime.beans.actions.misc.RunExecutableAction;

RunExecutableAction action = new RunExecutableAction();
action.setExecutable(...);
action.setArguments(...);

action.execute(context);
like image 126
Ingo Kegel Avatar answered Dec 10 '25 08:12

Ingo Kegel