This minimalist script depends only on programs from OpenBSD base. To encrypt your files use bioctl(8) with CRYPTO, openssl(1), or scrypt.
If you are looking for a deduplicating archiver, try borg(1).
Tested on OpenBSD 6.3
arc is an archiver with compression. It creates a spec of the original file tree with mtree(8), then creates a compressed archive with pax(1) and gzip(1).
$ ftp -Vo ~/bin/arc https://www.romanzolotarev.com/bin/arc arc 100% |********************| 18711 00:00 $ chmod +x ~/bin/arc
$ arc ~/src /tmp/archive /home/romanzolotarev/src 24080K /tmp/archive 16752K OKAY $ ls -1 /tmp/archive* /tmp/archive /tmp/archive.tree.gz /tmp/archive.tree.sha256 $
Restore one file from the archive and compare its contents with the original.
$ cd /tmp $ pax -pe -rzf /tmp/archive ./www/arc.md $ diff ~/src/www/arc.md ./www/arc.md $
arc_extract restores whole archive into current directory and compares restored files with the spec created by mtree(8).
Note: time of original files in spec is in nanoseconds, while pax(1) restores time in seconds. Therefore, we use sed to cut nanoseconds.
$ mkdir -p /tmp/restored && cd /tmp/restored $ arc_extract archive $
or just do the same manually:
$ mkdir -p /tmp/restored && cd /tmp/restored $ pax -pe -rzf /tmp/archive $ gunzip < /tmp/archive.tree.gz > /tmp/archive.tree $ sha256 < tree; cat /tmp/archive.tree.sha256 a4bc68... a4bc68... $ sed 's/time=\([0-9]*\)\.[0-9]*/time=\1.0/' /tmp/archive.tree|mtree $