# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
-# Copyright (C) 2002 Craig Barratt
+# Copyright (C) 2002-2003 Craig Barratt
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
#========================================================================
#
-# Version 2.0.0_CVS, released 3 Feb 2003.
+# Version 2.1.0_CVS, released 8 Feb 2004.
#
# See http://backuppc.sourceforge.net.
#
$RsyncLibOK = 0;
$RsyncLibErr = "File::RsyncP module doesn't exist";
} else {
- if ( $File::RsyncP::VERSION < 0.20 ) {
+ if ( $File::RsyncP::VERSION < 0.44 ) {
$RsyncLibOK = 0;
- $RsyncLibErr = "File::RsyncP module version too old: need 0.20";
+ $RsyncLibErr = "File::RsyncP module version too old: need 0.44";
} else {
$RsyncLibOK = 1;
}
# To make this easier we do all the includes first and all
# of the excludes at the end (hopefully they commute).
#
+ $file =~ s{/$}{};
$file = "/$file";
$file =~ s{//+}{/}g;
+ if ( $file eq "/" ) {
+ #
+ # This is a special case: if the user specifies
+ # "/" then just include it and don't exclude "/*".
+ #
+ push(@inc, $file) if ( !$incDone{$file} );
+ next;
+ }
my $f = "";
while ( $file =~ m{^/([^/]*)(.*)} ) {
my $elt = $1;
if ( $t->{type} eq "full" ) {
$logMsg = "full backup started for directory $t->{shareName}";
} else {
- $incrDate = $bpc->timeStampISO($t->{lastFull} - 3600, 1);
+ $incrDate = $bpc->timeStamp($t->{lastFull} - 3600, 1);
$logMsg = "incr backup started back to $incrDate for directory"
. " $t->{shareName}";
}
# transferred, even though it is a full dump.
#
$rsyncArgs = $conf->{RsyncArgs};
+ $rsyncArgs = [@$rsyncArgs, @fileList] if ( @fileList );
$rsyncArgs = [@$rsyncArgs, "--ignore-times"]
if ( $t->{type} eq "full" );
$rsyncClientCmd = $conf->{RsyncClientCmd};
$argList = ['--server', '--sender', @$rsyncArgs,
'.', $t->{shareNameSlash}];
$fioArgs = {
- client => $t->{client},
- share => $t->{shareName},
- viewNum => $t->{lastFullBkupNum},
+ client => $t->{client},
+ share => $t->{shareName},
+ viewNum => $t->{lastFullBkupNum},
+ partialNum => $t->{partialNum},
};
}
$t->{rs} = File::RsyncP->new({
logLevel => $conf->{RsyncLogLevel},
rsyncCmd => sub {
+ $bpc->verbose(0);
$bpc->cmdExecOrEval($rsyncClientCmd, $args);
},
rsyncCmdType => "full",
rsyncArgs => $rsyncArgs,
timeout => $conf->{ClientTimeout},
logHandler => sub {
- my($str) = @_;
- $str .= "\n";
- $t->{XferLOG}->write(\$str);
+ my($str) = @_;
+ $str .= "\n";
+ $t->{XferLOG}->write(\$str);
},
+ pidHandler => sub {
+ $t->{pidHandler}(@_);
+ },
fio => BackupPC::Xfer::RsyncFileIO->new({
xfer => $t,
bpc => $t->{bpc},
#
my $stats = $rs->statsFinal;
if ( !defined($error) && defined($stats) ) {
- $t->{xferOK} = 1;
+ $t->{xferOK} = 1;
} else {
- $t->{xferOK} = 0;
+ $t->{xferOK} = 0;
}
- $t->{byteCnt} = $stats->{childStats}{TotalFileSize}
- + $stats->{parentStats}{TotalFileSize};
- $t->{fileCnt} = $stats->{childStats}{TotalFileCnt}
- + $stats->{parentStats}{TotalFileCnt};
+ $t->{xferErrCnt} = $stats->{remoteErrCnt}
+ + $stats->{childStats}{errorCnt}
+ + $stats->{parentStats}{errorCnt};
+ $t->{byteCnt} = $stats->{childStats}{TotalFileSize}
+ + $stats->{parentStats}{TotalFileSize};
+ $t->{fileCnt} = $stats->{childStats}{TotalFileCnt}
+ + $stats->{parentStats}{TotalFileCnt};
+ my $str = "Done: $t->{fileCnt} files, $t->{byteCnt} bytes\n";
+ $t->{XferLOG}->write(\$str);
#
# TODO: get error count, and call fio to get stats...
#
{
my($t) = @_;
- return -1;
+ return ();
}
sub logMsg