Build a Unison package for Synology DSM
508 words, 3 minutes
For reasons, I’m turning my Synology DS918+ on and start using it again. One thing I need is files synchronization with my OpenBSD laptop. There is no Synology Drive client for OpenBSD so I’ll keep using Unison . But there is no Unison client / server binary for DSM 7.2.1-69057 Update 4.
Here’s how to compile and install the Unison File Synchronizer for Synology DSM 7.2.
Prepare the building environment
My DS918+ comes with an Intel Celeron J3455 . This is an Apollo Lake processor. This can be confirmed from the Synology when connecting via SSH and will be great to know later on.
# uname -a
Linux DS918p 4.4.302+ #69057 SMP Fri Jan 12 17:02:59 CST 2024 \
x86_64 GNU/Linux synology_apollolake_918+
Building Synology packages requires a 64bit Linux environment with
bash
, python
and git
. I’m using a Debian 12 virtual machine
running on the Synology.
Have your Linux building environment setup and log in to it.
Install prerequisites
Install the required tools.
# apt update
# apt -y upgrade
# apt -y install python3 git wget xz-utils
Install Synology toolkit
Grab a copy of the toolkit.
# mkdir -p /toolkit
# cd /toolkit
# git clone https://github.com/SynologyOpenSource/pkgscripts-ng
# cd /toolkit/pkgscripts-ng/
# git checkout DSM7.2
Deploy chroot environmment
The platform for the DS918+ was revealed previously: apollolake
.
Deploy the relevant environment and chroot to it to process to
compilation.
# cd /toolkit/pkgscripts-ng/
# ./EnvDeploy -v 7.2 -p apollolake
# cp -p /etc/ssl/certs/* ../build_env/ds.apollolake-7.2/etc/ssl/certs/
# chroot ../build_env/ds.apollolake-7.2
Build Unison
OpenBSD 7.4 provides ocaml-4.12.1p4
and unison-2.53.3p1
. At least,
the OCaml version needs to be the same.
OCaml
Grab the OCaml source, compile and install in the chroot.
# cd ~
# wget https://caml.inria.fr/pub/distrib/ocaml-4.12/ocaml-4.12.1.tar.gz
# tar xzf ocaml-4.12.1.tar.gz
# cd ocaml-4.12.1
# ./configure && make && make install
Unison
Grab the Unison source, compile and install in the home directory of the compiling user. This makes the transfer to the DSM user easier.
# cd ~
# wget https://github.com/bcpierce00/unison/archive/refs/tags/v2.53.4.tar.gz
# tar xzf v2.53.4.tar.gz
# cd unison-2.53.4
# make
# make PREFIX=~/.local install
Install Unison
The Unison binary can now be installed on the Synology. In my case, only a single user has access to SSH and Unison. Installation is done in the user’s home directory. Log in to DSM and transfer the Unison file.
$ cd ~
$ C_USER=build
$ C_HOST=<insert Linux Compilation Host IP>
$ scp -pr $C_USER@$C_HOST:/toolkit/build_env/ds.apollolake-7.2/$C_USER/.local .
Note that to be able to connect using SSH, the user has to be part of
the administrators
group.
Use Unison
Modify your profiles (*.prf
) to include the path to the unison binary:
servercmd = /var/services/homes/<insert your username here>/.local/bin/unison
Unison is now ready to be used from the OpenBSD laptop.
Using the toolkit, you’re supposed to be able to create a DSM package. I failed. I didn’t understand how to manage the dependency with OCaml. As I don’t really require it, I did not®. You may have more success reading the package examples .