lakka

I obviously wanted to make sure my save games and save states where all not only backed up to another local computer in my house(via rsync) but i also wanted an offsite copy. After looking around i decided to go with idrive. 5G free and they have a CLI that is supported on a surprising number of OS’s including Linux.

Setup

I set up an account and downloaded the Linux 64 bit version. It consists of a single executable that i then put in /storage/idrive. unfortunetly it requers libpopt which is not a part of lakka and lakka has no package management.

$ ldd idevsutil
 linux-vdso.so.1 (0x00007ffd0f5fe000)
 libpopt.so.0 => not found
 libdl.so.2 => /lib/libdl.so.2 (0x00007fd8a9486000)
 libc.so.6 => /lib/libc.so.6 (0x00007fd8a90e7000)
 /lib64/ld-linux-x86-64.so.2 (0x00007fd8a968a000)

Well shit. To fix this I started up a VirtualBox of, I think Arch, and scp’ed over libpopt.so.0 to /storage/idrive/. Problem solved, even if it is super hacky.

Configuration

We first have to configure our account to be able to use the CLI tool. You should create a file with your private encryption key password and another file containing your idrive password.  You can then run the –config-account option….

# ./idevsutil --config-account --enc-type=PRIVATE --pvt-key=/storage/idrive/pvt_key --user=USER_NAME --password-file=/storage/idrive/passwd
connection established

<tree message="SUCCESS" desc="ACCOUNT CONFIGURED" ⁄>

Success!. You now must fine the cmd utility server IP Address associated with your account. To do so run…

# ./idevsutil --getServerAddress USER_NAME
Password:

<tree message="SUCCESS" cmdUtilityServer="evs84.idrive.com" cmdUtilityServerIP="IP_ADDRESS" webApiServer="evsweb84.idrive.com" webApiServerIP="IP_ADDRESS"/>

HAZA! We can now finally start backing our things up.

Backing up

Create a file listing all the files and directors you want to back up. I called my file /storage/idrive/manifest

/storage/savestates
/storage/savefiles
/storage/playlists
/storage/idrive

I decided to also back up the idrive directory because it was a bit of a pain to set up. Because of this you need to add the –tmp=/tmp/idrive arguemnt to your commands. If you dont it will faile to back up some temporary files that you actually dont even want.

# ./idevsutil --pvt-key=/storage/idrive/pvt_key  --files-from=/storage/idrive/manifest / USER_NAME@CLI_IP_ADDRESS::home/lakka --password-file=/storage/idrive/passwd --temp=/tmp/idrive
connection established
building file list ...
====================================================================================
| FILE SIZE | TRANSFERED SIZE | TOTAL SIZE | PERCENTAGE | TRANSFER RATE | FILENAME |
====================================================================================
[ 2712553] [ 0] [ 46780031] [100%] [ 0.00kB/s] [storage/idrive/idevsutil]
[ 48240] [ 0] [ 46780031] [100%] [ 0.00kB/s] [storage/idrive/libpopt.so.0]

*** REMOVED DATA ***

[ 13179] [ 0] [ 46780031] [100%] [ 0.00kB/s] [storage/savestates/Nestopia/Darkwing Duck (USA).state.auto]
[ 430181] [ 0] [ 46780031] [100%] [ 0.00kB/s] [storage/savestates/Snes9x/Legend of Zelda, The - A Link to the Past (USA).state.auto]

sent 3500 bytes received 40 bytes 2360.00 bytes/sec

CRON

lastly we set up cron and or small shell script to back things up every 10 min.

Cron entry:

0,10,20,30,40,50 * * * * /storage/idrive/backup.sh > /storage/idrive/backup_`

1
date +"%H%M"`
.log 2>&1

(Not sure why wordpress is freaking the fuck out)

The backtick voodo is so i get an hours worth of backup logs that overwrite themselves after one hour. Helpful if there is an issue and i don’t have to worry about rotating or deleting old logs as it does that itself.

And the contents of the backup.sh is…

#!/bin/bash

LD_LIBRARY_PATH=/storage/idrive /storage/idrive/idevsutil --pvt-key=/storage/idrive/pvt_key --files-from=/storage/idrive/manifest / xxann5@173.255.9.166::home/lakka --password-file=/storage/idrive/passwd --temp=/tmp/idrive
date

And thats it. I can now relax and know that every 10 min all my save data will be nice and safe.

Share Button