I am implementing a silent updater where I do all the version check/ update availability check myself with custom codes and also the installation of the updater after the download. during the installation process I do backups and then perform the update installation and afterwards I perform some tests. All these are done using custom action codes and scripts.
Now for custom actions I know I can override
the rollback()
method and for scripts there is this "optional Rollback Script". But is there any action/ abstract class / listener class that I can use commonly for all the codes/scripts?
You can do this with an event listener:
context.addInstallerEventListener(new InstallerEventListener() {
@Override
public void installerEvent(InstallerEvent event) {
if (event.getType() == EventType.CANCELLING) {
// custom rollback
}
}
});
It will be called before the actions are rolled back. To do something after the actions have been rolled back, replace EventType.CANCELLING
with EventType.CANCELED
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.