Subject: | Compressed archives are created even if archive_copies is '0'. |
If archive_copies is set to '0', then a compressed archive is still
created and then subsequently removed; there is no option to not perform
a compression.
The attached patch provides a 'no_archive' option that will skip
archiving all together; the patch also provides the corresponding
documentation.
Subject: | Backup.pm.patch |
--- Backup.pm.orig 2007-11-08 09:27:42.000000000 -0800
+++ Backup.pm 2007-11-08 09:41:20.000000000 -0800
@@ -95,6 +95,11 @@
The number of old archive files to keep.
+=item no_archive
+
+If set to true, then no compressed archive(s) will be created
+even if archive_copies is set.
+
=item dir_copies
The number of old backup directories to keep.
@@ -183,6 +188,7 @@
$self->_setUseRm($$params{use_rm});
$self->{_archive_dir_regex} = $params->{dir_regex} if defined $params->{dir_regex};
$self->{_archive_file_regex} = $params->{file_regex} if defined $params->{file_regex};
+ $self->{_no_archive} = $params->{no_archive} ? defined $params->{no_archive} : 0;
# foreach my $exe ('tar', 'gzip', 'bzip2', 'rm', 'mv') {
# if (defined($Config{$exe}) and $Config{$exe} ne '') {
@@ -203,7 +209,8 @@
the first element is expected to be a directory that is to be
backed up, and the second should be the name the directory is
called once it has been copied to the backup directory. The
-return value is the name of the archive file created.
+return value is the name of the archive file created; unless
+'no_archive' is set, then it will return an empty string.
=cut
sub backup {
@@ -213,6 +220,7 @@
my $file_prefix = $self->getFilePrefix . $today;
my $backup_dir = $self->getBackupDir;
my $dst = "$backup_dir/$file_prefix";
+ my $dst_file = '';
mkdir $dst, 0755;
my $cp = $self->getCpPath;
@@ -225,14 +233,17 @@
}
}
- my $compress = $self->getCompressProgramPath;
- my $ext = $self->getCompressExtension;
- $ext = '.' . $ext unless $ext eq '';
- my $dst_file = $dst . '.tar' . $ext;
- my $params = '-p';
- $params = '-v ' . $params if $self->_getVerbose;
- my $tar_cmd = $self->getTarPath . " $params -c -f - -C '$backup_dir' '$file_prefix'";
- system "$tar_cmd | $compress > $dst_file";
+ unless ( $self->{_no_archive} )
+ {
+ my $compress = $self->getCompressProgramPath;
+ my $ext = $self->getCompressExtension;
+ $ext = '.' . $ext unless $ext eq '';
+ $dst_file = $dst . '.tar' . $ext;
+ my $params = '-p';
+ $params = '-v ' . $params if $self->_getVerbose;
+ my $tar_cmd = $self->getTarPath . " $params -c -f - -C '$backup_dir' '$file_prefix'";
+ system "$tar_cmd | $compress > $dst_file";
+ }
return $dst_file;
}