- if ($tar_size > $Conf{MaxArchiveFileSize}) {
- print STDERR " part too big $tar_size > $Conf{MaxArchiveFileSize} }}" if ($debug);
- $same = 0;
- last;
- } elsif ($size > $Conf{MaxArchiveSize}) {
- print STDERR " part bigger than media $size > $Conf{MaxArchiveSize} }}" if ($debug);
- $same = 0;
- last;
+ close($fh);
+
+ print ", $items items";
+
+ if ($tar_size_inarc == 0 && $items == 0) {
+ print ", EMPTY tar\n";
+
+ my $backup_id = get_backup_id($host, $share, $num);
+
+ my $sth_inc_deleted = $dbh->prepare(qq{
+ update backups set
+ inc_deleted = true
+ where id = ?
+ });
+ $sth_inc_deleted->execute($backup_id);
+
+ $dbh->commit;
+
+ return 1;
+ }
+
+ my $tar_size = get_gzip_size( $path );
+
+ # real tar size is bigger because of padding
+ if ($tar_size_inarc > $tar_size) {
+ print ", size of files in tar ($tar_size_inarc) bigger than whole tar ($tar_size)!\n";
+ return 0;
+ }
+
+ #
+ # check if md5 exists, and if not, create one
+ #
+
+ my $md5_path = $path;
+ $md5_path =~ s/\.tar\.gz$/.md5/ || die "can't create md5 filename from $md5_path";
+ if (! -e $md5_path || -z $md5_path) {
+ print ", creating md5";
+ system( $bin->{md5sum} . " $path > $md5_path") == 0 or die "can't create md5 $path: $!";
+ } else {
+ ## FIXME check if existing md5 is valid