X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FArchive.pm;h=603bdcc938d48d36a948de6074cd9d614d17ecf6;hp=e66babefa0a4821fd0e9a7d53299ee5ff0bb918a;hb=fda25dc88a63ccac1c80efa2e4994bf0725ca9b7;hpb=79e0593c501fd58046feeca20c315cc4ac283435 diff --git a/lib/BackupPC/CGI/Archive.pm b/lib/BackupPC/CGI/Archive.pm index e66babe..603bdcc 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-2007 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.0beta2, released 23 May 2004. +# Version 3.1.0, released 25 Nov 2007. # # 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}}");