--- trunk/bin/BackupPC_incPartsUpdate 2005/10/24 16:41:13 228 +++ trunk/bin/BackupPC_incPartsUpdate 2005/10/25 09:30:52 230 @@ -10,13 +10,18 @@ use Data::Dumper; use Time::HiRes qw/time/; use POSIX qw/strftime/; -use BackupPC::SearchLib; use Cwd qw/abs_path/; use File::Which; use Archive::Tar::Streamed; use Algorithm::Diff; use Getopt::Std; +my $bpc = BackupPC::Lib->new || die "can't create BackupPC::Lib"; +my %Conf = $bpc->Conf(); + +use BackupPC::SearchLib; +%BackupPC::SearchLib::Conf = %Conf; + # cludge: minimum .tar.gz size my $MIN_TAR_SIZE = 80; @@ -43,12 +48,6 @@ my $t_fmt = '%Y-%m-%d %H:%M:%S'; -my $hosts; -my $bpc = BackupPC::Lib->new || die; -my %Conf = $bpc->Conf(); -my $TopDir = $bpc->TopDir(); -my $beenThere = {}; - my $dsn = $Conf{SearchDSN} || die "Need SearchDSN in config.pl\n"; my $user = $Conf{SearchUser} || ''; @@ -178,7 +177,6 @@ my $sth_inc_size = $dbh->prepare(qq{ update backups set inc_size = ?, parts = ? where id = ? }); my $sth_inc_deleted = $dbh->prepare(qq{ update backups set inc_deleted = ? where id = ? }); -%BackupPC::SearchLib::Conf = %Conf; $sth->execute(); my $num_backups = $sth->rows; @@ -212,14 +210,21 @@ if ($size > $MIN_TAR_SIZE) { - my $max_size = $Conf{'MaxArchiveSize'} || die "problem with MaxArchieSize parametar"; + my $max_size = $Conf{'MaxArchiveSize'} || die "problem with MaxArchiveSize parametar"; $max_size *= 1024; # convert to bytes + my $max_file_size = $Conf{'MaxArchiveFileSize'} || die "problem with MaxArchiveFileSize parametar"; + $max_file_size *= 1024; # bytes + + if ($max_file_size > $max_size) { + warn "MaxArchiveFileSize ($max_file_size) is bigger than MaxArchiveSize ($max_size)\n"; + $max_file_size = $max_size; + } + # maximum file size on ISO image is 4Gb # this will require Linux kernel 2.6.8 or newer - my $max_iso_file_size = 2^32 - 2048; - if ( $max_size > $max_iso_file_size ) { - $max_size = $max_iso_file_size; + if ( $max_size > $max_file_size ) { + $max_size = $max_file_size; } my $parts = int( ($size + $max_size - 1) / $max_size );