Rollback if there is a problem

I have reduced potential problems affecting the users client to installing a downloaded update.

Specifically, when moving the files into their final location. Most likely, a security exception. If the move of either the updater or client files fails at any time during that process, the client would be corrupted.

The client installs updater files and the updater installs client files.

I can send a boolean to the client on startup that would tell it that the startup is clean, which could overcome the updater being corrupted. This would allow the client to simply delete the downloaded updater files and rerun the check for updates.

However, if something fails moving client files into place, I don’t see how to recover from that.

I could notify the user a critical error has occurred and they must re-install the client is all I can come up with.

Wondering how the pay to play installers handle that.

Suggestions?

I feel like steam somehow includes every version of the app that I ever downloaded. That could be hyperbole based on trying to backup my son’s home directory once.

Still, I think it would be reasonable to leave a completely working known-good version around and install the new stuff into a new version. Only get rid of the old one when there is a new known-good one.

Of course, that’s easy to say from my desk chair.

Maybe copy the entire folder for the client app into a temp dir before moving?

Edit: This is incremental updating of only different versioned files.

I do have a list of the old files thats going to be scrubbed. If only copied those, could be faster.

If there is a security exception, maybe I should have them manually copy those files back.

Yeah, build the new one up before using it to replace the old one is what I was thinking at a high level.