Unison 2.27.57 on Debian Etch and Ubuntu Hardy

The good thing about the file sync tool Unison is, that it’s available for several operating systems. This is great for groups working on different systems (Mac, Linux and Windows) but want to share and synchronize files on a remote server.

Well, the bad thing about Unison on the other hand is, that its backwards compatibility is anything but great, so that you have to make sure that everybody in the team uses the same version. And this can be tricky depending on what system you are using.

My home system is Ubuntu Hardy, the remote server system is Debian Etch. Both come with Unison 2.16.13 which would be great if not Apple’s new Leopard brings the newest version 2.27.57. Long story short, I needed the newest version on Hardy and Etch.

Unison on Hardy

To install the newest version of Unison on Hardy, it’s the best to just use the existing Backport package.

First, add the backports to the apt-sources, using your favorite editor, e.g. vi or nano:

sudo editor /etc/apt/sources.list

Look for backports and uncomment/add the following lines:

deb http://de.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

Then just install the backport using apt-get:

apt-get update
apt-get -t hardy-backports install unison

After installing you probably should remove the added lines from the sources.list -file. Otherwise the update-manager wants to install all available backports which is probably not what you want.

Debian Etch

Update 30/07/08: Before reading my post, please have a look at the much easier method described by Andrew in the user comments. Only if this doesn’t work, you might want to have a look at my post.

Unison 2.27.57 binary for Debian Etch:

If you don’t want to compile the binary on your own (as described in the following paragraphs), you can download the Unison 2.27.57 binary for Debian Etch here.

Update 30/11/08:

~ 300 downloads so far, no known problems/malfunctions!

It’s much more difficult on an Etch system because no Backport package is available. Therefore you either have to create such a package, which can be annoying and frustrating, or you just compile it on your own and overwrite the binary.

Add the unstable sources and the etch backports to your apt-get sources by editing the file /etc/apt/sources.list (as root!):

# Unstable source packages
deb-src ftp://ftp.de.debian.org/debian/ unstable main contrib non-free

# Backports for Etch
deb http://www.backports.org/debian etch-backports main contrib non-free

Now update apt and install the backport package of ocaml compiler. You also might want to install the debian backports keyring to avoid warning and error messages:

apt-get update
apt-get install debian-backports-keyring
apt-get update
apt-get -t etch-backports install ocaml

Then get the source package of unison 2.27.57 and make the binary:

apt-get update
apt-get source unison
dpkg-source -x unison_2.27.57-1.dsc
cd unison-2.27.57/
make

Note: For my Etch installation, the make progress failed with some error, but the binary was created successfully anyway. Just have a look whether the unison -binary exists and test if it is working.

./unison -version
unison version 2.27.57

Now install the old version of Unison and replace the binary with the new one. Also you might want to remove the lines from /etc/apt/sources.list and uninstall the ocaml compiler.

apt-get install unison
cp unison /usr/bin/
unison -version
unison version 2.27.57

That’s it! I know that this is not the best solution and that it might be better to create the backports package. But as there are many dependencies to other packages it’s maybe one of the fastest solutions.

I decided to publish the binary here (for the lazy ones): Unison 2.27.57 binary for Debian Etch.

Update: an easier method (from the comments)

Andrew Challen posted this much easier method in the comments of the original post:

Thanks for your tips they helped me build a .deb to install. After a long time playing around building my own .deb i found that the one in “testing” almost compiles, simply run the following instead of “make” and if you have all the build dependancies installed, a few apt-get’s and you will, it will build you two .deb which you can install with dpkg -i unison*.deb

awk ‘{gsub(/Build-Depends: .*/, “Build-Depends: cdbs (>= 0.4.23), debhelper (>= 5), dpatch, ocaml-nox (>= 3.09.2-9), liblablgtk2-ocaml-dev (>= 2.6.0-7), chrpath, librsvg2-bin (>= 2.14.4-3), imagemagick”); print $0 > “unison-2.27.57/debian/control”}’ unison-2.27.57/debian/control dpkg-buildpackage -rfakeroot