Example using binary releases

bees on beatiful flowers
Photo by Joshua J. Cotten / Unsplash

Starting with version v0.9.12 we are releasing precompiled binaries for various platforms and architectures.
See our Github site: https://github.com/eLyKseeR/elykseer-ml/releases

Preparations

Extract the zip of downloaded binaries to a directory and point the environment variable at them:

export LXR_BINARIES=${HOME}/Downloads/Darwin_arm64

(this might change depending on your platform)

Only on macOS: go into this directory and setup the binaries explicitly with the following commands. This is necessary as macOS retracts rights to execute a downloaded binary by default.

cd ${LXR_BINARIES}
sh ./setup.sh

(only required on macOS)

Also, define where to store meta data and encrypted chunks:

export LXR_DB=${HOME}/elykseer.db

export LXR_CHUNKS=${HOME}/elykseer.chunks

First, we need to create directories that will hold the meta data and the encrypted chunks from backups.

mkdir -v ${LXR_DB}

mkdir -v ${LXR_CHUNKS}

And, next we create irmin's configuration file and initialise the database:

cat << EOF > irmin.yml
root: ${LXR_DB}
store: git
contents: json-value
EOF

${LXR_BINARIES}/irmin init

Test run

Preparations

Let's create a few files with random data and remember their checksums:

MYID=test1
dd if=/dev/random of=test1M bs=1M count=1
dd if=/dev/random of=test4M bs=1M count=4
dd if=/dev/random of=test8M bs=1M count=8
md5sum test[148]M > md5sums || md5 test[148]M > md5sums

Backup

Then, encrypt and backup these files:

${LXR_BINARIES}/lxr_backup.exe -v -x ${LXR_CHUNKS} -d ${LXR_DB} -n 16 -i $MYID test1M test4M test8M

The output will look like this:

INFO finalising assembly 161e4e0d5096cb8b5cfffcbb2b437c7eb9a612a9424a6d03659e485b812ed96a with apos = 4161552
INFO encrypted assembly: 161e4e0d5096cb8b5cfffcbb2b437c7eb9a612a9424a6d03659e485b812ed96a
INFO block backup succeeded of file: test8M
INFO finalising assembly 318a57be77e51a00a4561ebc82691c97ee9ba894379a7b177cb215a29551b4a3 with apos = 4161552
INFO encrypted assembly: 318a57be77e51a00a4561ebc82691c97ee9ba894379a7b177cb215a29551b4a3
INFO block backup succeeded of file: test4M
INFO finalising assembly 755c4033d76f8a0a669fee253db850c7dc47502179bde27d7f71db17d3019638 with apos = 4161552
INFO encrypted assembly: 755c4033d76f8a0a669fee253db850c7dc47502179bde27d7f71db17d3019638
INFO block backup succeeded of file: test1M
INFO finalising assembly d7b1f4bf29cfcf2a6ce994ebece3ecb18127dab027a94ec7125418ecffbc195d with apos = 1146896
INFO encrypted assembly: d7b1f4bf29cfcf2a6ce994ebece3ecb18127dab027a94ec7125418ecffbc195d
done.
    total allocated: 9997965.000000

We can inspect a file's meta data using its filehash:

FHASH=$(${LXR_BINARIES}/lxr_filehash.exe -f test1M -i ${MYID} | cut -d ' ' -f 2)

${LXR_BINARIES}/irmin get ${MYID}/relfiles/${FHASH:4:2}/${FHASH} | jq -r 

Restore

Let's recreate the files from the encrypted chunks with the help of meta data:

PREVPWD=$(pwd)
TEMPORARY=$(mktemp -d)
${LXR_BINARIES}/lxr_restore.exe -v -x ${LXR_CHUNKS} -d ${LXR_DB} -n 16 -i $MYID -o ${TEMPORARY} test1M test4M test8M
cd ${TEMPORARY}
md5sum -c ${PREVPWD}/md5sums
cd ${PREVPWD}

The output will look like this:

INFO restoring file test8M from 256 blocks
INFO restoring file test4M from 128 blocks
INFO restoring file test1M from 32 blocks
  restored 3 files with 13631488 bytes in total

And, the validation of the restored files might be done so:

cd ${TEMPORARY}
md5sum -c ${PREVPWD}/md5sums || { md5 test[148]M | diff - ${PREVPWD}/md5sums && echo OK || echo failed; }
cd ${PREVPWD}

The above command should output "OK" to indicate that the file checksums of the restored files match the one previously recorded.