* A failed full dump is now saved as a partial (incomplete) dump,
[BackupPC.git] / lib / BackupPC / Xfer / Tar.pm
index 60326e1..f8f22dc 100644 (file)
@@ -11,7 +11,7 @@
 #   Craig Barratt  <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2001  Craig Barratt
+#   Copyright (C) 2001-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
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 1.6.0_CVS, released 10 Dec 2002.
+# Version 2.1.0_CVS, released 3 Jul 2003.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -82,11 +82,7 @@ sub start
     local(*TAR);
 
     if ( $t->{type} eq "restore" ) {
-       if ( ref($conf->{TarClientRestoreCmd}) eq "ARRAY" ) {
-           $tarClientCmd = $conf->{TarClientRestoreCmd};
-       } else {
-           $tarClientCmd = [split(/ +/, $conf->{TarClientRestoreCmd})];
-       }
+       $tarClientCmd = $conf->{TarClientRestoreCmd};
         $logMsg = "restore started below directory $t->{shareName}";
        #
        # restores are considered to work unless we see they fail
@@ -139,7 +135,7 @@ sub start
            $args = $conf->{TarFullArgs};
             $logMsg = "full backup started for directory $t->{shareName}";
         } else {
-            $incrDate = $bpc->timeStampISO($t->{lastFull} - 3600, 1);
+            $incrDate = $bpc->timeStamp($t->{lastFull} - 3600, 1);
            $args = $conf->{TarIncrArgs};
             $logMsg = "incr backup started back to $incrDate for directory"
                     . " $t->{shareName}";
@@ -149,15 +145,17 @@ sub start
     #
     # Merge variables into @tarClientCmd
     #
-    $tarClientCmd = $bpc->cmdVarSubstitute($tarClientCmd, {
+    my $args = {
         host      => $t->{host},
         hostIP    => $t->{hostIP},
+        client    => $t->{client},
         incrDate  => $incrDate,
         shareName => $t->{shareName},
        fileList  => \@fileList,
         tarPath   => $conf->{TarClientPath},
         sshPath   => $conf->{SshPath},
-    });
+    };
+    $tarClientCmd = $bpc->cmdVarSubstitute($tarClientCmd, $args);
     if ( !defined($t->{xferPid} = open(TAR, "-|")) ) {
         $t->{_errStr} = "Can't fork to run tar";
         return;
@@ -191,11 +189,12 @@ sub start
         #
         # Run the tar command
         #
-       $bpc->cmdExecOrEval($tarClientCmd);
+       $bpc->cmdExecOrEval($tarClientCmd, $args);
         # should not be reached, but just in case...
         $t->{_errStr} = "Can't exec @$tarClientCmd";
         return;
     }
+    my $str = "Running: " . $bpc->execCmd2ShellCmd(@$tarClientCmd) . "\n";
     $t->{XferLOG}->write(\"Running: @$tarClientCmd\n");
     alarm($conf->{ClientTimeout});
     $t->{_errStr} = undef;
@@ -264,7 +263,7 @@ sub xferPid
 {
     my($t) = @_;
 
-    return $t->{xferPid};
+    return ($t->{xferPid});
 }
 
 sub logMsg