-#!/bin/perl -T
+#!/bin/perl
#============================================================= -*-perl-*-
#
# BackupPC_link: link new backup into pool
# 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
#
#========================================================================
#
-# Version 2.0.0, released 14 Jun 2003.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
use BackupPC::Lib;
use BackupPC::Attrib;
use BackupPC::PoolWrite;
+use BackupPC::Storage;
use File::Find;
use File::Path;
#
my $noFill = 1;
my $fillFromNum;
- if ( $Backups[$num]{type} eq "full" ) {
+ if ( $Backups[$num]{type} ne "incr" ) {
$noFill = 0
} elsif ( $Conf{IncrFill} ) {
my $i;
$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);
}
#
# 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);
+ }
}
}