~aleteoryx/backupper

9080b45d44383b08fb6b58d3bcefa2b758faa373 — Aleteoryx 9 months ago e78900d
readme, fixes
2 files changed, 25 insertions(+), 2 deletions(-)

A README.md
M backupper.tcl
A README.md => README.md +23 -0
@@ 0,0 1,23 @@
# Backupper

a compressing deduplicating snapshot backup system, written in Tcl.

- dependencies:
  - sqlite3
  - tcllib

the script expects a linux environment, as it reads `/proc/cpuinfo` to get the number of cores. I believe there are no other platform-specific behaviors, so patching this script for windows or other unices would be trivial.

to use it

1. `backupper.tcl init <store>` some store directory. this is where backup data will go. backupper does not care what or where this directory is as long as it has read/write.
2. `backupper.tcl importtar <store> <name> <tarball>` a tarball. the file data inside of it will be extracted and deduplicated, and the tarball itself will be stored with an id and hash.
3. `backupper.tcl export <store> <id>` the id from step 2. the tarball will be replicated identically in the current directory, with file data restored

there is also a simpler `importlist` command that takes in a list of files, one per line, and works similarly. on export, they will be placed in a local directory.

there are also commands for inspecting the contents of the store, run the script with no args for more info.

to list the backups in a store, run `sqlite3 -box <store>/index.db 'select rowid, * from tarballs'`. at some point I might add a command for this.

GLHF don't sue me if this fails spectacularly

M backupper.tcl => backupper.tcl +2 -2
@@ 325,7 325,7 @@ switch -- $command {
      append result [::tar::fmtrec [tpool::get $pool $job]]
    }

    append result [binary format a[expr {16384 - ([string length $result] % 16384) + 512}] ""]
    append result [binary format a[expr {16384 - ([string length $result] % 16384)}] ""]

    set ref [writestore $arpath $result 1]
    set date [clock seconds]


@@ 391,7 391,7 @@ switch -- $command {
          tpool::wait $pool $job
          puts -nonewline $exportfd [::tar::fmtrec [tpool::get $pool $job]]
        }
        puts -nonewline $exportfd [binary format a[expr {16384 - ([tell $exportfd] % 16384) + 512}] ""]
        puts -nonewline $exportfd [binary format a[expr {16384 - ([tell $exportfd] % 16384)}] ""]

        close $exportfd
      }