test.sh
- excercise rsync server to test basic operation and deduplication
+FULL=1 ./user-md5sum.pl u2001 | md5sum -c
+ - generates md5sum file for user with optional full paths for easy scrubing
+
Installation on Debian:
sudo ./remove-user.sh test@example.com
sudo ./remove-user.sh test2@example.com
+base_dir=`pwd`
RSYNC_LOGIN=`sudo ./create-user.sh test@example.com secret 500k`
RSYNC_LOGIN2=`sudo ./create-user.sh test2@example.com secret 20k`
push .sync -rv
-fi # skip tests
-
ps ax > perms-test
chmod 400 perms-test
push -va perms-test
sudo sh -xc "ls -al ~$RSYNC_LOGIN/localhost/"
pull
+
+
+fi # skip tests
+
+
+find /test/s1/2001/ -type f | grep -v '/\.' | xargs md5sum | sort > /tmp/test/1
+FULL=1 $base_dir/user-md5sum.pl u2001 | sort > /tmp/test/2
+
+diff /tmp/test/1 /tmp/test/2 && echo "OK - md5 database consistant with filesystem"
+
--- /dev/null
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+use TokyoCabinet;
+use Data::Dump qw(dump);
+
+my $user = shift @ARGV || die "usage: $0 u2001\n";
+
+my $dir = (getpwnam($user))[7];
+
+die $! unless -d $dir;
+
+my $path = "$dir/.md5";
+
+die $! unless -r $path;
+
+my %h;
+tie %h, "TokyoCabinet::HDB", $path || die $!;
+
+while( my($k,$v) = each(%h) ) {
+ $k = "$dir/$k" if $ENV{FULL};
+ print "$v $k\n";
+}
+