Monthly Archives: March 2011

“One-touch” app installation and update with SVN

One of my responsibilities at work is to develop and distribute several applications to a different division. These apps all consist of an exe (we’re a Windows shop), some supporting files and an INI config file. They need to be run on several independent PC’s.

The division I am supporting does have technicians, but they are neither hugely technically competent nor blessed with much time to get stuff done, so a “one-touch” installation or update procedure is desired.

There are several ways this could be done, perhaps by distributing an MSI installer which is then installed on each PC. Here is another technique which works for me. It leverages SVN, both because that’s where my code lives and because both sides of this game have access to our SVN server.

  1. Ensure the exe and additional files are under SVN control.
  2. Tag the version of the exe which should be distributed. This will be svn://path/to/current/tag
  3. Create an SVN location with a name something like “current_location“. A good location would perhaps be in the SVN folder of the project, but it really only matters that it is somewhere in your SVN tree.
  4. Check the “current_location” directory out to a local working copy.
  5. Create an svn:external property on this working copy, like so:
    app svn://path/to/current/tag
    Check the “current_location” directory back in.
  6. On each PC the app is to run on, checkout the “current_location” directory. The app will be in a directory called “app” in the checkout location.

The “current_location” directory is now effectively a pointer to the version of the app in current use.

When the app needs updating, create a new tag and edit the svn:external property of your local copy of the “current_location” directory to reflect the new tag and check in. Instruct the technicians to SVN update on their side. This could be done by right-clicking in Windows Explorer via TortoiseSVN for eg.

For a more one-touch solution, I also provide a Windows batch file to automate the checking out of the app on the technicians’ side. This can be quite easily done using the SVN command line implementation made freely available by collabnet (it is of course even easier to do on Unix).

There are some further Windows tricks you can use to make the batch file more comprehensive and useful, but this is enough for now. I’ll write about enhancing the batch file in a (hopefully short-term) future post.

Leave a Comment

Filed under svn, windows_tricks, work