X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FArchive.pm;h=f20bed3e8c4efaa84f157f2a9ad3a2c8e73fe7d4;hp=758cac35ce9538dde7c6b04dbf97d141777aa5ce;hb=f9796d809e6a7d4ed2c356f0f32f1a3d628d3d1f;hpb=8f5625f9cdf47f8e04be654c4954838b2df3e26d diff --git a/lib/BackupPC/CGI/Archive.pm b/lib/BackupPC/CGI/Archive.pm index 758cac3..f20bed3 100644 --- a/lib/BackupPC/CGI/Archive.pm +++ b/lib/BackupPC/CGI/Archive.pm @@ -10,7 +10,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2003 Craig Barratt +# Copyright (C) 2003-2009 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 @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0beta0, released 20 Mar 2004. +# Version 3.2.0, released 31 Jul 2010. # # See http://backuppc.sourceforge.net. # @@ -98,16 +98,23 @@ EOF } else { my(@HostList, @BackupList, $HostListStr, $hiddenStr, $pathHdr, $badFileCnt, $reply, $str); + + # + # Pick up the archive host's config file + # + $bpc->ConfigRead($archHost); + %Conf = $bpc->Conf(); + my $args = { - SplitPath => $bpc->{Conf}{SplitPath}, - ParPath => $bpc->{Conf}{ParPath}, - CatPath => $bpc->{Conf}{CatPath}, - GzipPath => $bpc->{Conf}{GzipPath}, - Bzip2Path => $bpc->{Conf}{Bzip2Path}, - ArchiveDest => $bpc->{Conf}{ArchiveDest}, - ArchiveComp => $bpc->{Conf}{ArchiveComp}, - ArchivePar => $bpc->{Conf}{ArchivePar}, - ArchiveSplit => $bpc->{Conf}{ArchiveSplit}, + SplitPath => $Conf{SplitPath}, + ParPath => $Conf{ParPath}, + CatPath => $Conf{CatPath}, + GzipPath => $Conf{GzipPath}, + Bzip2Path => $Conf{Bzip2Path}, + ArchiveDest => $Conf{ArchiveDest}, + ArchiveComp => $Conf{ArchiveComp}, + ArchivePar => $Conf{ArchivePar}, + ArchiveSplit => $Conf{ArchiveSplit}, topDir => $bpc->{TopDir}, }; @@ -136,42 +143,42 @@ EOF } my ($ArchiveDest, $ArchiveCompNone, $ArchiveCompGzip, $ArchiveCompBzip2, $ArchivePar, $ArchiveSplit); - $ArchiveDest = $bpc->{Conf}{ArchiveDest}; - if ( $bpc->{Conf}{ArchiveComp} eq "none" ) { + $ArchiveDest = $Conf{ArchiveDest}; + if ( $Conf{ArchiveComp} eq "none" ) { $ArchiveCompNone = "checked"; } else { $ArchiveCompNone = ""; } - if ( $bpc->{Conf}{ArchiveComp} eq "gzip" ) { + if ( $Conf{ArchiveComp} eq "gzip" ) { $ArchiveCompGzip = "checked"; } else { $ArchiveCompGzip = ""; } - if ( $bpc->{Conf}{ArchiveComp} eq "bzip2" ) { + if ( $Conf{ArchiveComp} eq "bzip2" ) { $ArchiveCompBzip2 = "checked"; } else { $ArchiveCompBzip2 = ""; } - $ArchivePar = $bpc->{Conf}{ArchivePar}; - $ArchiveSplit = $bpc->{Conf}{ArchiveSplit}; + $ArchivePar = $Conf{ArchivePar}; + $ArchiveSplit = $Conf{ArchiveSplit}; if ( $In{type} == 1 ) { # # Tell the user what options they have # my $paramStr = ""; - if ( $bpc->{Conf}{ArchiveClientCmd} =~ /\$archiveloc\b/ ) { + if ( $Conf{ArchiveClientCmd} =~ /\$archiveloc\b/ ) { $paramStr .= eval("qq{$Lang->{BackupPC_Archive2_location}}"); } - if ( $bpc->{Conf}{ArchiveClientCmd} =~ /\$compression\b/ ) { + if ( $Conf{ArchiveClientCmd} =~ /\$compression\b/ ) { $paramStr .= eval("qq{$Lang->{BackupPC_Archive2_compression}}"); } - if ( $bpc->{Conf}{ArchiveClientCmd} =~ /\$parfile\b/ - && -x $bpc->{Conf}{ParPath} ) { + if ( $Conf{ArchiveClientCmd} =~ /\$parfile\b/ + && -x $Conf{ParPath} ) { $paramStr .= eval("qq{$Lang->{BackupPC_Archive2_parity}}"); } - if ( $bpc->{Conf}{ArchiveClientCmd} =~ /\$splitsize\b/ - && -x $bpc->{Conf}{SplitPath} ) { + if ( $Conf{ArchiveClientCmd} =~ /\$splitsize\b/ + && -x $Conf{SplitPath} ) { $paramStr .= eval("qq{$Lang->{BackupPC_Archive2_split}}"); } my $content = eval("qq{$Lang->{BackupPC_Archive2}}"); @@ -218,12 +225,13 @@ EOF [ \%ArchiveReq], [qw(*ArchiveReq)]); $archive->Indent(1); - if ( open(REQ, ">$TopDir/pc/$archivehost/$reqFileName") ) { + my $openPath = "$TopDir/pc/$archivehost/$reqFileName"; + if ( open(REQ, ">", $openPath) ) { binmode(REQ); print(REQ $archive->Dump); close(REQ); } else { - ErrorExit($Lang->{Can_t_open_create} ); + ErrorExit(eval("qq{$Lang->{Can_t_open_create__openPath}}")); } $reply = $bpc->ServerMesg("archive $User $archivehost $reqFileName"); $str = eval("qq{$Lang->{Archive_requested}}");