You are not logged in.

#1 2019-01-25 15:53:29

jamielinux
Member
From: United Kingdom
Registered: 2014-03-14
Posts: 7
Website

rotcheck: Recursively generate, update and verify checksums

Had loads of fun fooling around with this script. Picked POSIX shell for maximum pain, but for some reason I enjoy such challenges big_smile

Useful for detecting bit rot and then restoring from somewhere. Hopefully you have backups. And if it's your backups that have bit rotted, hopefully you have multiple backups wink

There are faster tools available already (usually written in C/C++)... but where's the fun in that! Thought the Arch community might appreciate this. Would be interesting to hear opinions on some of the crazy inside the script lol

Usage

Create first checksum file (located at "./.rotcheck"):

$ cd /backups
$ rotcheck -a

You've added some new files and need to append some checksums:

$ cd /backups
$ rotcheck -av
ADDED: ./backups/foo/one.tar.gz
ADDED: ./backups/foo/two.tar.gz

You've edited some files and need to update the checksums (for files with a modification time newer than the checksum file):

$ cd /backups
$ rotcheck -uv
CHANGED: ./backups/bar/three.tar.gz

Verify checksums:

$ cd /backups
$ rotcheck -c
./backups/baz/bitrot.tar.gz: FAILED
sha512sum: WARNING: 1 of 49231 computed checksums did NOT match
Links

Last edited by jamielinux (2019-01-25 16:03:36)

Offline

Board footer

Powered by FluxBB