X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FXfer.pm;h=45c8b541715bb04864b2c1e1ddc99fb0ad18f1fe;hp=2977015dd23a5159551aa916edb2ddf7077735bc;hb=ca593f66fd6c35764bd8997c6338b781330f019c;hpb=f076585d3ff9dfe6de32292b897e293008efe74e;ds=sidebyside diff --git a/lib/BackupPC/Xfer.pm b/lib/BackupPC/Xfer.pm index 2977015..45c8b54 100644 --- a/lib/BackupPC/Xfer.pm +++ b/lib/BackupPC/Xfer.pm @@ -12,7 +12,7 @@ # Paul Mantz # # COPYRIGHT -# Copyright (C) 2008 Zmanda +# Copyright (C) 2001-2009 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 @@ -30,7 +30,7 @@ # #======================================================================== # -# Version 3.1.0+ +# Version 3.2.0beta0, released 5 April 2009. # # See http://backuppc.sourceforge.net. # @@ -134,6 +134,67 @@ sub getShareNames return $ShareNames; } + +sub getRestoreCmd +{ + my($conf) = @_; + my $restoreCmd; + + if ( $conf->{XferMethod} eq "archive" ) { + $restoreCmd = undef; + + } elsif ( $conf->{XferMethod} eq "ftp" ) { + $restoreCmd = undef; + + } elsif ( $conf->{XferMethod} eq "rsync" + || $conf->{XferMethod} eq "rsyncd" ) { + $restoreCmd = $conf->{RsyncRestoreArgs}; + + } elsif ( $conf->{XferMethod} eq "tar" ) { + $restoreCmd = $conf->{TarClientRestoreCmd}; + + } elsif ( $conf->{XferMethod} eq "smb" ) { + $restoreCmd = $conf->{SmbClientRestoreCmd}; + + } else { + + # + # protocol unrecognized + # + $restoreCmd = undef; + } + return $restoreCmd; +} + + +sub restoreEnabled +{ + my($conf) = @_; + my $restoreCmd; + + if ( $conf->{XferMethod} eq "archive" ) { + return; + + } elsif ( $conf->{XferMethod} eq "ftp" ) { + return; + + } elsif ( $conf->{XferMethod} eq "rsync" + || $conf->{XferMethod} eq "rsyncd" + || $conf->{XferMethod} eq "tar" + || $conf->{XferMethod} eq "smb" ) { + $restoreCmd = getRestoreCmd( $conf ); + return !!( + ref $restoreCmd eq "ARRAY" + ? @$restoreCmd + : $restoreCmd ne "" + ); + + } else { + return; + } +} + + sub errStr { return $errStr;