From 9080b45d44383b08fb6b58d3bcefa2b758faa373 Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Sun, 23 Feb 2025 23:11:06 -0500 Subject: [PATCH] readme, fixes --- README.md | 23 +++++++++++++++++++++++ backupper.tcl | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2893fed6cfe3084b18d9f2f4f861d9bb995f8c2e --- /dev/null +++ b/README.md @@ -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 ` 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 ` 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 ` 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 /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 diff --git a/backupper.tcl b/backupper.tcl index 7c698814729dc5289a0c4b7ccfca40a8d98ba677..5d5f01b268bd676062e5d63c882cbd0965900ce8 100755 --- a/backupper.tcl +++ b/backupper.tcl @@ -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 }