X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_restore;h=4549ccfc3ca4b8d0f00a1d6208ae8b5b393c8cd3;hp=f23afe8635b792b591c967b4da3110c756d79a75;hb=5b79f9a3c01bca16dd4d211e76fc53daa549e421;hpb=f8c20efc11f400acafb7833947bae6c299467ef6 diff --git a/bin/BackupPC_restore b/bin/BackupPC_restore index f23afe8..4549ccf 100755 --- a/bin/BackupPC_restore +++ b/bin/BackupPC_restore @@ -40,10 +40,7 @@ no utf8; use lib "/usr/local/BackupPC/lib"; use BackupPC::Lib; use BackupPC::FileZIO; -use BackupPC::Xfer::Smb; -use BackupPC::Xfer::Tar; -use BackupPC::Xfer::Rsync; -use BackupPC::Xfer::BackupPCd; +use BackupPC::Xfer; use Socket; use File::Path; @@ -236,37 +233,14 @@ if ( $? && $Conf{UserCmdCheckStatus} ) { } $NeedPostCmd = 1; -if ( $Conf{XferMethod} eq "tar" ) { - # - # Use tar (eg: tar/ssh) as the transport program. - # - $xfer = BackupPC::Xfer::Tar->new($bpc); -} elsif ( $Conf{XferMethod} eq "rsync" || $Conf{XferMethod} eq "rsyncd" ) { - # - # Use rsync as the transport program. - # - if ( !defined($xfer = BackupPC::Xfer::Rsync->new($bpc)) ) { - my $errStr = BackupPC::Xfer::Rsync->errStr; - UserCommandRun("RestorePostUserCmd") if ( $NeedPostCmd ); - $stat{hostError} = $errStr; - exit(RestoreCleanup($client)); - } -} elsif ( $Conf{XferMethod} eq "backuppcd" ) { - # - # Use backuppcd as the transport program. - # - if ( !defined($xfer = BackupPC::Xfer::BackupPCd->new($bpc)) ) { - my $errStr = BackupPC::Xfer::BackupPCd->errStr; - UserCommandRun("RestorePostUserCmd") if ( $NeedPostCmd ); - $stat{hostError} = $errStr; - exit(RestoreCleanup($client)); - } -} else { - # - # Default is to use smbclient (smb) as the transport program. - # - $xfer = BackupPC::Xfer::Smb->new($bpc); +$xfer = BackupPC::Xfer::create($Conf{XferMethod}, $bpc); +if ( !defined($xfer) ) { + my $errStr = BackupPC::Xfer::errStr(); + UserCommandRun("RestorePostUserCmd") if ( $NeedPostCmd ); + $stat{hostError} = $errStr; + exit(RestoreCleanup($client)); } + my $useTar = $xfer->useTar; if ( $useTar ) {