BackupPC_archiveStart (BackupPC-4.3.2) | : | BackupPC_archiveStart (BackupPC-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
# | # | |||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | |||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
# | # | |||
# Version 4.3.2, released 17 Feb 2020. | # Version 4.4.0, released 20 Jun 2020. | |||
# | # | |||
# See http://backuppc.sourceforge.net. | # See http://backuppc.sourceforge.net. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
use strict; | use strict; | |||
no utf8; | no utf8; | |||
use lib "__INSTALLDIR__/lib"; | use lib "__INSTALLDIR__/lib"; | |||
use Getopt::Std; | use Getopt::Std; | |||
use BackupPC::Lib; | use BackupPC::Lib; | |||
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); | die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); | |||
my %opts; | my %opts; | |||
# no options currently | # no options currently | |||
if ( !getopts("", \%opts) || @ARGV < 3 ) { | if ( !getopts("", \%opts) || @ARGV < 3 ) { | |||
skipping to change at line 84 | skipping to change at line 84 | |||
my $host = $ARGV[$i]; | my $host = $ARGV[$i]; | |||
if ( !defined($Hosts->{$host}) ) { | if ( !defined($Hosts->{$host}) ) { | |||
print(STDERR "$0: host $host doesn't exist... quitting\n"); | print(STDERR "$0: host $host doesn't exist... quitting\n"); | |||
exit(1); | exit(1); | |||
} | } | |||
my @backups = $bpc->BackupInfoRead($host); | my @backups = $bpc->BackupInfoRead($host); | |||
if ( !@backups ) { | if ( !@backups ) { | |||
print(STDERR "$0: host $host doesn't have any backups... quitting\n"); | print(STDERR "$0: host $host doesn't have any backups... quitting\n"); | |||
exit(1); | exit(1); | |||
} | } | |||
push(@HostList, $host); | push(@HostList, $host); | |||
push(@BackupList, $backups[$#backups]{num}); | push(@BackupList, $backups[$#backups]{num}); | |||
} | } | |||
my $ReqFileName; | my $ReqFileName; | |||
for ( my $i = 0 ; ; $i++ ) { | for ( my $i = 0 ; ; $i++ ) { | |||
$ReqFileName="archiveReq.$$.$i"; | $ReqFileName = "archiveReq.$$.$i"; | |||
last if ( !-f "$TopDir/pc/$ArchiveHost/$ReqFileName" ); | last if ( !-f "$TopDir/pc/$ArchiveHost/$ReqFileName" ); | |||
} | } | |||
my %ArchiveReq = ( | my %ArchiveReq = ( | |||
archiveloc => $bpc->{Conf}{ArchiveDest}, | archiveloc => $bpc->{Conf}{ArchiveDest}, | |||
archtype => 0, | archtype => 0, | |||
compression => $bpc->{Conf}{ArchiveComp} eq 'none' ? $bpc->{Conf}{CatPath} | compression => $bpc->{Conf}{ArchiveComp} eq 'none' ? $bpc->{Conf}{CatPath} | |||
: ($bpc->{Conf}{ArchiveComp} eq 'gzip' | : ($bpc->{Conf}{ArchiveComp} eq 'gzip' ? $bpc->{Conf}{GzipPath} : $bpc->{Con | |||
? $bpc->{Conf}{GzipPath} : $bpc->{Conf}{Bzip2Path}), | f}{Bzip2Path}), | |||
compext => $bpc->{Conf}{ArchiveComp} eq 'none' ? '' | compext => $bpc->{Conf}{ArchiveComp} eq 'none' ? '' | |||
: ($bpc->{Conf}{ArchiveComp} eq 'gzip' ? '.gz' : '.bz2'), | : ($bpc->{Conf}{ArchiveComp} eq 'gzip' ? '.gz' : '.bz2'), | |||
parfile => $bpc->{Conf}{ArchivePar}, | parfile => $bpc->{Conf}{ArchivePar}, | |||
splitsize => '0000000', | splitsize => '0000000', | |||
host => $ArchiveHost, | host => $ArchiveHost, | |||
HostList => \@HostList, | HostList => \@HostList, | |||
BackupList => \@BackupList, | BackupList => \@BackupList, | |||
user => $UserName, | user => $UserName, | |||
reqTime => time, | reqTime => time, | |||
); | ); | |||
my $archive = Data::Dumper->new([\%ArchiveReq], [qw(*ArchiveReq)]); | my $archive = Data::Dumper->new([\%ArchiveReq], [qw(*ArchiveReq)]); | |||
$archive->Indent(1); | $archive->Indent(1); | |||
if ( !open(REQ, ">", "$TopDir/pc/$ArchiveHost/$ReqFileName") ) { | if ( !open(REQ, ">", "$TopDir/pc/$ArchiveHost/$ReqFileName") ) { | |||
print(STDERR "$0: can't open/write request file $TopDir/pc/$ArchiveHost/$Req FileName... quitting\n"); | print(STDERR "$0: can't open/write request file $TopDir/pc/$ArchiveHost/$Req FileName... quitting\n"); | |||
exit(1); | exit(1); | |||
} | } | |||
binmode(REQ); | binmode(REQ); | |||
print REQ $archive->Dump; | print REQ $archive->Dump; | |||
close(REQ); | close(REQ); | |||
End of changes. 5 change blocks. | ||||
15 lines changed or deleted | 15 lines changed or added |