Press "Enter" to skip to content

Libres pensées d'un mathématicien ordinaire Posts

Unison

Unison file synchronizer

I have been using for years Unison over SSH to synchronize periodically, automatically, recursively, and bidirectionally my files across my different machines : desktops, laptops, servers, … Unison is an excellent program, which comes with command line interface as well as graphical interface. The problem with Unison is its sensitivity to version numbers. It requires same version on both client and server. Recently, I have experienced an even more subtle sensitivity, Unison seems to require sometimes that both sides were compiled with same version of OCaml compiler!

My desktop computer provides unison 2.48.4 on Ubuntu 20.04 while the department server provides unison 2.48.3 on Ubuntu 16.04. They are incompatible. The simplest would be to ask the sysadmin to upgrade from 16.04 to 20.04 of course. But in the mean time, a user space workaround consists in compiling statically unison on the desktop and copying the static binary on the department server. This is easily done as both machines have same architecture (amd64), cross-compilation can be a delicate task.

#  get some tools necessary for compilation (adapt to your needs)
desktop$ sudo apt install ocaml make
# add source code to /etc/apt/sources.prf by using GUI or manual edit
desktop$ software-properties-gtk
# update dpkg database
desktop$ sudo apt update
# get unison source code
desktop$ apt source unison
# move to the sources
desktop$ cd unison-2.48.4/
# compile a static binary
desktop$ make STATIC=true
# copy this binary to the department server
desktop$ scp unison department.server:~/.u-2.48.4-static
# instruct unison to use this binary by adding a line in configuration file
desktop$ echo ‘servercmd=/home/users/chafai/.u-2.48.4-static’ >> ~/.unison/dep.prf
# test it!
desktop$ unison dep
Here is the compressed binary file: unison-2.48.4-amd64-static.gz.

 

Leave a Comment
Syntax · Style · .