use DateTime::Duration to correctly convert partial dates in to fields
[BackupPC.git] / bin / BackupPC_link
index d05b61c..7d66784 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/perl
+#!/usr/bin/perl
 #============================================================= -*-perl-*-
 #
 # BackupPC_link: link new backup into pool
@@ -21,7 +21,7 @@
 #   Craig Barratt  <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2001-2003  Craig Barratt
+#   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
@@ -39,7 +39,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.2.0, released 31 Jul 2010.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -108,12 +108,23 @@ while ( 1 ) {
     $CurrDumpDir = "$Dir/$Backups[$num]{num}";
     $Compress = $Backups[$num]{compress};
     if ( open(NEW, "<", "$Dir/NewFileList.$Backups[$num]{num}") ) {
+        my(@shareAttribArgs);
        binmode(NEW);
         while ( <NEW> ) {
             chomp;
             next if ( !/(\w+) (\d+) (.*)/ );
-            LinkNewFile($1, $2, "$CurrDumpDir/$3");
+            if ( $3 eq "attrib" ) {
+                #
+                # Defer linking top-level attrib file until the end
+                # since it can appear multiple times when multiple shares
+                # are dumped.
+                #
+                @shareAttribArgs = ($1, $2, "$CurrDumpDir/$3");
+            } else {
+                LinkNewFile($1, $2, "$CurrDumpDir/$3");
+            }
         }
+        LinkNewFile(@shareAttribArgs) if ( @shareAttribArgs );
         close(NEW);
     }
     unlink("$Dir/NewFileList.$Backups[$num]{num}")