<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi all,</p>
<p>Following the discussions we had a few months ago, I have started
on a stop-gap solution to get something close to an Android port
of Unison. The whole thing is still very much in
pre-proof-of-concept stage, so there is no public code repository
yet.</p>
<p>The finished product is called Lite for a reason: since we don’t
have a portable Unison library with an API for any UI to attach
to, my best bet at the moment was to take a static build of the
current Unison binary and warp it into a native Android UI. That
means it’s going to be limited to whatever Unison can do in batch
mode – specifically, it will not be possible to resolve conflicts
on a per-file basis or exclude individual files from
synchronization on a case-by-case basis.</p>
<p>The UI will allow adding, editing and deleting profiles, as well
as starting synchronization and monitoring status.</p>
<p>One big challenge was to build Unison. As far as I can tell, a
static build for Linux will also run on Android as long as the ABI
matches. Since there are no actively maintained cross-compilers
for OCaml that I know of, I am building Unison in a foreign
chroot.</p>
<p>The next one is to deploy native binaries with an Android app and
run them – this is not quite trivial, but with some research, I
got that to work as well. By the way, once you have taken that
step, running the binary with root privileges (on a rooted device)
is not terribly difficult. (Which is indeed a use case, allowing
Unison to be used for backing up the entire data partition of the
device, not just shared storage.)<br>
</p>
<p>Another challenge is the dependency of Unison on an SSH binary on
the device. Unmodified OpenSSH does not seem to build for Android
targets. However, I have found a version modified for Android,
which is MagiskSSH (<a class="moz-txt-link-freetext" href="https://urldefense.com/v3/__https://gitlab.com/d4rcm4rc/MagiskSSH__;!!IBzWLUs!Ve1jdc3CFj1XSBcFbN0uiBDBjel9R0cx4oi-IL38Pn5h0rOiVatukz2sXgiFly18nqwZadrxcW77oE1H3KaTNIhfkxih_rsV$">https://gitlab.com/d4rcm4rc/MagiskSSH</a>). While
intended to be part of Magisk (a root add-on for Android), it
compiles for Android and starts up without crashing. So far, so
good.</p>
<p>The main issue at the moment is that SSH expects a certain level
of interactivity: when a password is needed for authentication, or
the authentication key is protected with a passphrase, or if the
server responds with an unknown fingerprint (or worse, a changed
one), SSH expects user input – by default on the console.</p>
<p>For passwords/passphrases, I understand I can set the SSH_ASKPASS
environment variable to some program that prompts for the password
and, after it is entered, prints it on its stdout. I’d just need
to find a way to implement that on Android somehow.</p>
<p>For host keys, no idea how catch this from the GUI.<br>
</p>
<p>Questions:</p>
<p>* How does the Unison GUI deal with changed host keys?</p>
<p>* I take it from earlier discussions that Unison is designed to
work with different SSH binaries. What SSH backends other than
OpenSSH has Unison been tested with? Are they any easier in their
interactivity requirements than OpenSSH?<br>
</p>
</body>
</html>