{"id":14049,"date":"2020-09-01T15:03:10","date_gmt":"2020-09-01T13:03:10","guid":{"rendered":"http:\/\/djalil.chafai.net\/blog\/?p=14049"},"modified":"2020-09-08T22:29:11","modified_gmt":"2020-09-08T20:29:11","slug":"unison","status":"publish","type":"post","link":"https:\/\/djalil.chafai.net\/blog\/2020\/09\/01\/unison\/","title":{"rendered":"Unison"},"content":{"rendered":"<p><a href=\"http:\/\/djalil.chafai.net\/blog\/wp-content\/uploads\/2020\/09\/unison-gtk.svg_.png\"><img loading=\"lazy\" class=\"size-full wp-image-14051 aligncenter\" src=\"http:\/\/djalil.chafai.net\/blog\/wp-content\/uploads\/2020\/09\/unison-gtk.svg_.png\" alt=\"Unison file synchronizer\" width=\"256\" height=\"256\" srcset=\"https:\/\/djalil.chafai.net\/blog\/wp-content\/uploads\/2020\/09\/unison-gtk.svg_.png 256w, https:\/\/djalil.chafai.net\/blog\/wp-content\/uploads\/2020\/09\/unison-gtk.svg_-80x80.png 80w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">I have been using for years <a href=\"https:\/\/github.com\/bcpierce00\/unison\">Unison<\/a> over <a href=\"https:\/\/en.wikipedia.org\/wiki\/Secure_Shell\">SSH<\/a> 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 <a href=\"https:\/\/en.wikipedia.org\/wiki\/OCaml\">OCaml<\/a> compiler!<\/p>\n<p style=\"text-align: justify;\">My desktop computer provides unison 2.48.4 on <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ubuntu\">Ubuntu<\/a> 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 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Static_build\">compiling statically<\/a> unison on the desktop and copying the static binary on the department server. This is easily done as both machines have same architecture (<a href=\"https:\/\/en.wikipedia.org\/wiki\/X86-64\">amd64<\/a>), <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cross_compiler\">cross-compilation<\/a> can be a delicate task.<\/p>\n<blockquote>\n<div>\n<div>#\u00a0 get some tools necessary for compilation (adapt to your needs)<\/div>\n<div><span style=\"color: #999999;\"><strong>desktop$<\/strong><\/span> <strong>sudo apt install ocaml make<\/strong><\/div>\n<div># add source code to \/etc\/apt\/sources.prf by using GUI or manual edit<\/div>\n<\/div>\n<div><strong><span style=\"color: #999999;\">desktop$<\/span><\/strong>\u00a0<strong>software-properties-gtk<\/strong><\/div>\n<div># update dpkg database<\/div>\n<div><strong><span style=\"color: #999999;\">desktop$<\/span><\/strong> <strong>sudo apt update<\/strong><\/div>\n<div># get unison source code<\/div>\n<div><span style=\"color: #999999;\"><strong>desktop$<\/strong><\/span>\u00a0<strong>apt source unison<\/strong><\/div>\n<div># move to the sources<\/div>\n<div><strong><span style=\"color: #999999;\">desktop$<\/span><\/strong>\u00a0<strong>cd unison-2.48.4\/<\/strong><\/div>\n<div># compile a static binary<\/div>\n<div><strong><span style=\"color: #999999;\">desktop$<\/span><\/strong>\u00a0<strong>make STATIC=true<\/strong><\/div>\n<div># copy this binary to the department server<\/div>\n<div><strong><span style=\"color: #999999;\">desktop$<\/span><\/strong>\u00a0<strong>scp unison department.server<a tabindex=\"-1\" title=\"https:\/\/www.ceremade.dauphine.fr:\" href=\"https:\/\/www.ceremade.dauphine.fr:\" target=\"_blank\" rel=\"noreferrer noopener\">:~\/.u-2.48.4-static<\/a><\/strong><\/div>\n<div># instruct unison to use this binary by adding a line in configuration file<\/div>\n<div><strong><span style=\"color: #999999;\">desktop$<\/span><\/strong> <strong>echo 'servercmd=\/home\/users\/chafai\/.u-2.48.4-static' &gt;&gt; ~\/.unison\/dep.prf<\/strong><\/div>\n<div># test it!<\/div>\n<div><span style=\"color: #999999;\"><strong>desktop$ <\/strong><\/span><strong>unison dep<\/strong><\/div>\n<\/blockquote>\n<div>Here is the compressed binary file: <a href=\"\/blog\/wp-content\/uploads\/unison-2.48.4-amd64-static.gz\">unison-2.48.4-amd64-static.gz<\/a>.<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been using for years Unison over SSH to synchronize periodically, automatically, recursively, and bidirectionally my files across my different machines : desktops, laptops,&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/djalil.chafai.net\/blog\/2020\/09\/01\/unison\/\">Continue reading<span class=\"screen-reader-text\">Unison<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":79},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/posts\/14049"}],"collection":[{"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/comments?post=14049"}],"version-history":[{"count":35,"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/posts\/14049\/revisions"}],"predecessor-version":[{"id":14087,"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/posts\/14049\/revisions\/14087"}],"wp:attachment":[{"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/media?parent=14049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/categories?post=14049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/djalil.chafai.net\/blog\/wp-json\/wp\/v2\/tags?post=14049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}