projects
/
BackupPC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added humanly readable unit (b k M G)
[BackupPC.git]
/
bin
/
BackupPC_tarCreate
diff --git
a/bin/BackupPC_tarCreate
b/bin/BackupPC_tarCreate
index
5548672
..
9af2931
100755
(executable)
--- a/
bin/BackupPC_tarCreate
+++ b/
bin/BackupPC_tarCreate
@@
-1,4
+1,4
@@
-#!/bin/perl
+#!/
usr/
bin/perl
#============================================================= -*-perl-*-
#
# BackupPC_tarCreate: create a tar archive of an existing dump
#============================================================= -*-perl-*-
#
# BackupPC_tarCreate: create a tar archive of an existing dump
@@
-21,8
+21,8
@@
# -t print summary totals
# -r pathRemove path prefix that will be replaced with pathAdd
# -p pathAdd new path prefix
# -t print summary totals
# -r pathRemove path prefix that will be replaced with pathAdd
# -p pathAdd new path prefix
-# -b BLOCKS
BLOCKS x 512 bytes per record
(default 20; same as tar)
-# -w
writeBufSz write buffer size (default
1MB)
+# -b BLOCKS
output write buffer size in 512-byte blocks
(default 20; same as tar)
+# -w
readBufSz buffer size for reading files (default 1048576 =
1MB)
# -e charset charset for encoding file names (default: value of
# $Conf{ClientCharset} when backup was done)
# -l just print a file listing; don't generate an archive
# -e charset charset for encoding file names (default: value of
# $Conf{ClientCharset} when backup was done)
# -l just print a file listing; don't generate an archive
@@
-37,7
+37,7
@@
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
-# Copyright (C) 2001-200
3
Craig Barratt
+# Copyright (C) 2001-200
9
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
#
# 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
@@
-55,7
+55,7
@@
#
#========================================================================
#
#
#========================================================================
#
-# Version 3.
0.0, released 28 Jan 2007
.
+# Version 3.
2.0, released 31 Jul 2010
.
#
# See http://backuppc.sourceforge.net.
#
#
# See http://backuppc.sourceforge.net.
#
@@
-76,7
+76,7
@@
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
my %opts;
my %opts;
-if ( !getopts("Llte:h:n:p:r:s:b:w:", \%opts) || @ARGV < 1 ) {
+if ( !getopts("Llte:h:n:p:r:s:b:w:
i
", \%opts) || @ARGV < 1 ) {
print STDERR <<EOF;
usage: $0 [options] files/directories...
Required options:
print STDERR <<EOF;
usage: $0 [options] files/directories...
Required options:
@@
-90,10
+90,13
@@
usage: $0 [options] files/directories...
-t print summary totals
-r pathRemove path prefix that will be replaced with pathAdd
-p pathAdd new path prefix
-t print summary totals
-r pathRemove path prefix that will be replaced with pathAdd
-p pathAdd new path prefix
- -b BLOCKS
BLOCKS x 512 bytes per record
(default 20; same as tar)
- -w
writeBufSz write buffer size
(default 1048576 = 1MB)
+ -b BLOCKS
output write buffer size in 512-byte blocks
(default 20; same as tar)
+ -w
readBufSz buffer size for reading files
(default 1048576 = 1MB)
-e charset charset for encoding file names (default: value of
\$Conf{ClientCharset} when backup was done)
-e charset charset for encoding file names (default: value of
\$Conf{ClientCharset} when backup was done)
+ -l just print a file listing; don't generate an archive
+ -L just print a detailed file listing; don't generate an archive
+ -i create incremental tar dump with just new files
EOF
exit(1);
}
EOF
exit(1);
}
@@
-138,8
+141,17
@@
if ( $opts{s} =~ m{(^|/)\.\.(/|$)} ) {
exit(1);
}
exit(1);
}
+# XXX ASA Search extension
+my $view_opts;
+
+my %Conf = $bpc->Conf;
+if ( $Conf{TarCreateIncremental} || $opts{i} ) {
+ warn "# incremental dump";
+ $view_opts = { only_increment => 1 };
+}
+
our $ShareName = $opts{s};
our $ShareName = $opts{s};
-our $view = BackupPC::View->new($bpc, $Host, \@Backups);
+our $view = BackupPC::View->new($bpc, $Host, \@Backups
, $view_opts
);
#
# This constant and the line of code below that uses it are borrowed
#
# This constant and the line of code below that uses it are borrowed
@@
-184,13
+196,15
@@
if ( $ShareName eq "*" ) {
archiveWriteHardLinks($fh);
}
archiveWriteHardLinks($fh);
}
-#
-# Finish with two null 512 byte headers, and then round out a full
-# block.
-#
-my $data = "\0" x ($tar_header_length * 2);
-TarWrite($fh, \$data);
-TarWrite($fh, undef);
+if ( !$opts{l} && !$opts{L} ) {
+ #
+ # Finish with two null 512 byte headers, and then round out a full
+ # block.
+ #
+ my $data = "\0" x ($tar_header_length * 2);
+ TarWrite($fh, \$data);
+ TarWrite($fh, undef);
+}
#
# print out totals if requested
#
# print out totals if requested
@@
-597,6
+611,12
@@
sub TarWriteFile
$hdr->{size} = 0;
TarWriteFileInfo($fh, $hdr);
$SpecialCnt++;
$hdr->{size} = 0;
TarWriteFileInfo($fh, $hdr);
$SpecialCnt++;
+ } elsif ( $hdr->{type} == BPC_FTYPE_SOCKET
+ || $hdr->{type} == BPC_FTYPE_UNKNOWN ) {
+ #
+ # ignore these two file types - these are dynamic file types created
+ # by applications as needed
+ #
} else {
print(STDERR "Got unknown type $hdr->{type} for $hdr->{name}\n");
$ErrorCnt++;
} else {
print(STDERR "Got unknown type $hdr->{type} for $hdr->{name}\n");
$ErrorCnt++;