X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FXfer%2FRsync.pm;h=ee14c36219b4f9a756d7ba7ee5989885a39796be;hp=b07c33b57aabceb166eb517a6585ccc1148a1657;hb=75b84adc52496b24bd606333226aca5ce7424f65;hpb=3dc33e5f39430031766adf3c5bb2ffc649ee9100 diff --git a/lib/BackupPC/Xfer/Rsync.pm b/lib/BackupPC/Xfer/Rsync.pm index b07c33b..ee14c36 100644 --- a/lib/BackupPC/Xfer/Rsync.pm +++ b/lib/BackupPC/Xfer/Rsync.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 1.6.0_CVS, released 10 Dec 2002. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -52,9 +52,9 @@ BEGIN { $RsyncLibOK = 0; $RsyncLibErr = "File::RsyncP module doesn't exist"; } else { - if ( $File::RsyncP::VERSION < 0.20 ) { + if ( $File::RsyncP::VERSION < 0.30 ) { $RsyncLibOK = 0; - $RsyncLibErr = "File::RsyncP module version too old: need 0.20"; + $RsyncLibErr = "File::RsyncP module version too old: need 0.30"; } else { $RsyncLibOK = 1; } @@ -119,7 +119,7 @@ sub start # # We add a slash to the share name we pass to rsync # - ($t->{shareNameSlash} = "$t->{shareName}/") =~ s{//+$}{}; + ($t->{shareNameSlash} = "$t->{shareName}/") =~ s{//+$}{/}; if ( $t->{type} eq "restore" ) { $rsyncClientCmd = $conf->{RsyncClientRestoreCmd}; @@ -128,7 +128,7 @@ sub start $remoteDir =~ s{//+}{/}g; $argList = ['--server', @$rsyncArgs, '.', $remoteDir]; $fioArgs = { - host => $t->{bkupSrcHost}, + client => $t->{bkupSrcHost}, share => $t->{bkupSrcShare}, viewNum => $t->{bkupSrcNum}, fileList => $t->{fileList}, @@ -234,7 +234,7 @@ sub start $argList = ['--server', '--sender', @$rsyncArgs, '.', $t->{shareNameSlash}]; $fioArgs = { - host => $t->{host}, + client => $t->{client}, share => $t->{shareName}, viewNum => $t->{lastFullBkupNum}, }; @@ -243,16 +243,17 @@ sub start # # Merge variables into $rsyncClientCmd # - $rsyncClientCmd = $bpc->cmdVarSubstitute($rsyncClientCmd, - { - host => $t->{host}, - hostIP => $t->{hostIP}, - shareName => $t->{shareName}, - shareNameSlash => $t->{shareNameSlash}, - rsyncPath => $conf->{RsyncClientPath}, - sshPath => $conf->{SshPath}, - argList => $argList, - }); + my $args = { + host => $t->{host}, + hostIP => $t->{hostIP}, + client => $t->{client}, + shareName => $t->{shareName}, + shareNameSlash => $t->{shareNameSlash}, + rsyncPath => $conf->{RsyncClientPath}, + sshPath => $conf->{SshPath}, + argList => $argList, + }; + $rsyncClientCmd = $bpc->cmdVarSubstitute($rsyncClientCmd, $args); # # Create the Rsync object, and tell it to use our own File::RsyncP::FileIO @@ -263,10 +264,11 @@ sub start $t->{rs} = File::RsyncP->new({ logLevel => $conf->{RsyncLogLevel}, rsyncCmd => sub { - $bpc->cmdExecOrEval($rsyncClientCmd); + $bpc->cmdExecOrEval($rsyncClientCmd, $args); }, rsyncCmdType => "full", rsyncArgs => $rsyncArgs, + timeout => $conf->{ClientTimeout}, logHandler => sub { my($str) = @_; $str .= "\n"; @@ -278,7 +280,6 @@ sub start conf => $t->{conf}, backups => $t->{backups}, logLevel => $conf->{RsyncLogLevel}, - timeout => $conf->{ClientTimeout}, logHandler => sub { my($str) = @_; $str .= "\n"; @@ -317,7 +318,10 @@ sub run # # Run rsync command # - $t->{XferLOG}->write(\"Running: @{$t->{rsyncClientCmd}}\n"); + my $str = "Running: " + . $t->{bpc}->execCmd2ShellCmd(@{$t->{rsyncClientCmd}}) + . "\n"; + $t->{XferLOG}->write(\$str); $rs->remoteStart($remoteSend, $remoteDir); } else { # @@ -326,6 +330,9 @@ sub run if ( defined(my $err = $rs->serverConnect($t->{hostIP}, $conf->{RsyncdClientPort})) ) { $t->{hostError} = $err; + my $str = "Error connecting to rsync daemon at $t->{hostIP}" + . ":$conf->{RsyncdClientPort}: $err\n"; + $t->{XferLOG}->write(\$str); return; } # @@ -338,6 +345,9 @@ sub run $conf->{RsyncdUserName}, $conf->{RsyncdPasswd}, $conf->{RsyncdAuthRequired})) ) { + my $str = "Error connecting to module $module at $t->{hostIP}" + . ":$conf->{RsyncdClientPort}: $err\n"; + $t->{XferLOG}->write(\$str); $t->{hostError} = $err; return; }