#!/usr/bin/perl -w

## rsync wrapper, concept borrowed from 
## http://www.sct.gu.edu.au/~anthony/info/apps/rsync.hints
my $line = $ENV{SSH_ORIGINAL_COMMAND} || '';

if ( $line =~ m#^(/usr/bin/)?rsync --server --sender # ) {
	my @args = qw( --server --sender -blogDtpr --delete-excluded --delete-after --numeric-ids . );
	my ($foundDir) = ($line) =~ m#(\S+)$#;
	exec("/usr/bin/rsync", @args, $foundDir);
} else {
	print STDERR "That is not a valid command\n";
	exit 1;
}
