* version header update
[BackupPC.git] / lib / BackupPC / Xfer.pm
index b585e25..d61d3d2 100644 (file)
@@ -12,7 +12,7 @@
 #   Paul Mantz  <pcmantz@zmanda.com>
 #
 # 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.
 #
@@ -43,7 +43,6 @@ use strict;
 use Encode qw/from_to encode/;
 
 use BackupPC::Xfer::Archive;
-use BackupPC::Xfer::BackupPCd;
 use BackupPC::Xfer::Ftp;
 use BackupPC::Xfer::Protocol;
 use BackupPC::Xfer::Rsync;
@@ -65,12 +64,6 @@ sub create
         $errStr = BackupPC::Xfer::Archive::errStr() if ( !defined($xfer) );
         return $xfer;
 
-    } elsif ( $protocol eq 'backuppcd' ) {
-
-        $xfer = BackupPC::Xfer::BackupPCd->new( $bpc, $args );
-        $errStr = BackupPC::Xfer::BackupPCd::errStr() if ( !defined($xfer) );
-        return $xfer;
-
     } elsif ( $protocol eq 'ftp' ) {
 
         $xfer = BackupPC::Xfer::Ftp->new( $bpc, $args );
@@ -127,9 +120,6 @@ sub getShareNames
     } elsif ( $conf->{XferMethod} eq "rsync" || $conf->{XferMethod} eq "rsyncd" ) {
         $ShareNames = $conf->{RsyncShareName};
 
-    } elsif ( $conf->{XferMethod} eq "backuppcd" ) {
-        $ShareNames = $conf->{BackupPCdShareName};
-
     } elsif ( $conf->{XferMethod} eq "smb" ) {
         $ShareNames = $conf->{SmbShareName};
 
@@ -144,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 !!( $conf->{FtpRestoreEnabled} );
+
+    } 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;