X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_link;h=5a58ae4ee0a959527ee0da99b8bff2da65c158b5;hp=8cc2894c0fbf14a2891533126ba1674a68fc9bbd;hb=5b79f9a3c01bca16dd4d211e76fc53daa549e421;hpb=79e0593c501fd58046feeca20c315cc4ac283435 diff --git a/bin/BackupPC_link b/bin/BackupPC_link index 8cc2894..5a58ae4 100755 --- a/bin/BackupPC_link +++ b/bin/BackupPC_link @@ -21,7 +21,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2003 Craig Barratt +# Copyright (C) 2001-2007 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 2.1.0beta2, released 23 May 2004. +# Version 3.1.0, released 25 Nov 2007. # # See http://backuppc.sourceforge.net. # @@ -51,6 +51,7 @@ use lib "/usr/local/BackupPC/lib"; use BackupPC::Lib; use BackupPC::Attrib; use BackupPC::PoolWrite; +use BackupPC::Storage; use File::Find; use File::Path; @@ -156,6 +157,16 @@ while ( 1 ) { $Backups[$num]{sizeNewComp} += $sizeNewComp; $Backups[$num]{noFill} = $noFill; $Backups[$num]{fillFromNum} = $fillFromNum; + # + # Save just this backup's info in case the main backups file + # gets corrupted + # + BackupPC::Storage->backupInfoWrite($Dir, + $Backups[$num]{num}, + $Backups[$num], 1); + # + # Save the main backups file + # $bpc->BackupInfoWrite($host, @Backups); } @@ -211,7 +222,21 @@ sub FillIncr # # Exists in the older filled backup, and not in the new, so link it # - link($name, $newName); + my($exists, $digest, $origSize, $outSize, $errs) + = BackupPC::PoolWrite::LinkOrCopy( + $bpc, + $name, $Compress, + $newName, $Compress); + if ( $exists ) { + $nFilesExist++; + $sizeExist += $origSize; + $sizeExistComp += $outSize; + } elsif ( $outSize > 0 ) { + $nFilesNew++; + $sizeNew += $origSize; + $sizeNewComp += -s $outSize; + LinkNewFile($digest, $origSize, $newName); + } } }