Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good general approach to writing an upgrade tool

I need to write an upgrade tool for a simple java application. It should work on an existing installation directory, and update property and binary files. It should not ruin the existing directory to allow "undo" in case it fails while in process.

I'm thinking of the general following algorithm:

  1. Create new directory next to existing one
  2. Extract new binaries into new directory
  3. Copy and merge whatever needs to be copied from older directory to new one
  4. Rename older directory to whatever.tmp.random#
  5. Rename newer directory to older dir's original name
  6. Remove older directory

Is there a known pattern or free-ish 3rd party packages to do upgrades in Java? I don't want/need an expensive installer product.

like image 401
adaf Avatar asked Nov 13 '22 09:11

adaf


1 Answers

You're pretty spot-on with your idea of how to do an upgrade. Since the upgrade process is unique to your application, third party libraries and whatnot probably won't be too useful. I'd recommend just writing your own upgrade methods.

like image 77
Zach Latta Avatar answered Nov 15 '22 06:11

Zach Latta