From 5b3e6091d542c2e7445d5dd511cdf6e20aec8b8d Mon Sep 17 00:00:00 2001 From: cbarratt Date: Sun, 29 Jan 2006 19:05:11 +0000 Subject: [PATCH] - fixed configure.pl and makeDist. - added lib/BackupPC/Xfer/BackupPCd.pm as initial template for backuppcd support. --- CVS_README | 13 +- bin/BackupPC | 57 +++--- bin/BackupPC_archive | 2 +- bin/BackupPC_archiveHost | 2 +- bin/BackupPC_attribPrint | 12 +- bin/BackupPC_compressPool | 7 +- bin/BackupPC_dump | 23 ++- bin/BackupPC_link | 2 +- bin/BackupPC_nightly | 2 +- bin/BackupPC_restore | 13 +- bin/BackupPC_sendEmail | 9 +- bin/BackupPC_serverMesg | 2 +- bin/BackupPC_tarCreate | 2 +- bin/BackupPC_tarExtract | 4 +- bin/BackupPC_tarPCCopy | 7 +- bin/BackupPC_trashClean | 2 +- bin/BackupPC_zcat | 2 +- bin/BackupPC_zipCreate | 2 +- cgi-bin/BackupPC_Admin | 2 +- conf/config.pl | 68 +++++++ configure.pl | 55 +++--- lib/BackupPC/Attrib.pm | 2 +- lib/BackupPC/CGI/AdminOptions.pm | 2 +- lib/BackupPC/CGI/Archive.pm | 2 +- lib/BackupPC/CGI/ArchiveInfo.pm | 2 +- lib/BackupPC/CGI/Browse.pm | 2 +- lib/BackupPC/CGI/DirHistory.pm | 2 +- lib/BackupPC/CGI/EmailSummary.pm | 2 +- lib/BackupPC/CGI/GeneralInfo.pm | 2 +- lib/BackupPC/CGI/HostInfo.pm | 2 +- lib/BackupPC/CGI/LOGlist.pm | 4 +- lib/BackupPC/CGI/Lib.pm | 13 +- lib/BackupPC/CGI/Queue.pm | 2 +- lib/BackupPC/CGI/ReloadServer.pm | 2 +- lib/BackupPC/CGI/Restore.pm | 2 +- lib/BackupPC/CGI/RestoreFile.pm | 2 +- lib/BackupPC/CGI/RestoreInfo.pm | 2 +- lib/BackupPC/CGI/StartServer.pm | 2 +- lib/BackupPC/CGI/StartStopBackup.pm | 2 +- lib/BackupPC/CGI/StopServer.pm | 2 +- lib/BackupPC/CGI/Summary.pm | 2 +- lib/BackupPC/CGI/View.pm | 4 +- lib/BackupPC/Config/Meta.pm | 2 +- lib/BackupPC/FileZIO.pm | 2 +- lib/BackupPC/Lib.pm | 40 +++-- lib/BackupPC/PoolWrite.pm | 2 +- lib/BackupPC/Storage.pm | 2 +- lib/BackupPC/Storage/Text.pm | 81 +++++---- lib/BackupPC/View.pm | 2 +- lib/BackupPC/Xfer/Archive.pm | 2 +- lib/BackupPC/Xfer/BackupPCd.pm | 266 ++++++++++++++++++++++++++++ lib/BackupPC/Xfer/Rsync.pm | 2 +- lib/BackupPC/Xfer/RsyncDigest.pm | 2 +- lib/BackupPC/Xfer/RsyncFileIO.pm | 16 +- lib/BackupPC/Xfer/Smb.pm | 2 +- lib/BackupPC/Xfer/Tar.pm | 2 +- lib/BackupPC/Zip/FileMember.pm | 2 +- makeDist | 19 +- 58 files changed, 598 insertions(+), 191 deletions(-) create mode 100644 lib/BackupPC/Xfer/BackupPCd.pm diff --git a/CVS_README b/CVS_README index 8a061d4..3ce7b78 100644 --- a/CVS_README +++ b/CVS_README @@ -27,8 +27,8 @@ Fetching CVS: cvs -z3 -d:pserver:anonymous@cvs.backuppc.sourceforge.net:/cvsroot/backuppc co -r v1_5_0 BackupPC -Building an installable release from the source: ------------------------------------------------ +Building an installable release from the CVS source: +--------------------------------------------------- * Edit makeDist and set the version number and release date @@ -38,6 +38,11 @@ Building an installable release from the source: all the library paths etc back into the symbolic form (eg: __INSTALLDIR__) so that configure.pl will do the right thing. + Often the language files are not up to date, and makeDist exits after + complaining about the lang files being inconsistent. Use the -l option + to turn off that checking. + * You should now have a sub-directory dist/BackupPC-version containing - the release and a tar ball dist/BackupPC-version.tar.gz. The tar - ball can be copied, extracted and installed like any BackupPC release. + the release and a tar ball dist/BackupPC-VERSION.tar.gz. The tar + ball can be copied, extracted and installed using configure.pl + like any BackupPC release. diff --git a/bin/BackupPC b/bin/BackupPC index 2a81d11..f4e4af7 100755 --- a/bin/BackupPC +++ b/bin/BackupPC @@ -6,7 +6,7 @@ # DESCRIPTION # # BackupPC reads the configuration and status information from -# $TopDir/conf. It then runs and manages all the backup activity. +# $ConfDir/conf. It then runs and manages all the backup activity. # # As specified by $Conf{WakeupSchedule}, BackupPC wakes up periodically # to queue backups on all the PCs. This is a four step process: @@ -47,7 +47,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -87,6 +87,7 @@ if ( !getopts("d", \%opts) || @ARGV != 0 ) { die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); my $TopDir = $bpc->TopDir(); my $BinDir = $bpc->BinDir(); +my $LogDir = $bpc->LogDir(); my %Conf = $bpc->Conf(); # @@ -111,10 +112,10 @@ if ( $Conf{BackupPCUserVerify} # # Read old status # -if ( -f "$TopDir/log/status.pl" && !(my $ret = do "$TopDir/log/status.pl") ) { - die "couldn't parse $TopDir/log/status.pl: $@" if $@; - die "couldn't do $TopDir/log/status.pl: $!" unless defined $ret; - die "couldn't run $TopDir/log/status.pl"; +if ( -f "$LogDir/status.pl" && !(my $ret = do "$LogDir/status.pl") ) { + die "couldn't parse $LogDir/status.pl: $@" if $@; + die "couldn't do $LogDir/status.pl: $!" unless defined $ret; + die "couldn't run $LogDir/status.pl"; } # @@ -344,7 +345,7 @@ sub Main_Initialize # Write out our initial status and save our PID # StatusWrite(); - if ( open(PID, ">", "$TopDir/log/BackupPC.pid") ) { + if ( open(PID, ">", "$LogDir/BackupPC.pid") ) { print(PID $$); close(PID); } @@ -803,15 +804,15 @@ sub Main_Check_Timeout $Info{DUDailySkipHostCntPrev} = $Info{DUDailySkipHostCnt}; $Info{DUDailySkipHostCnt} = 0; my $lastLog = $Conf{MaxOldLogFiles} - 1; - if ( -f "$TopDir/log/LOG.$lastLog" ) { + if ( -f "$LogDir/LOG.$lastLog" ) { print(LOG $bpc->timeStamp, - "Removing $TopDir/log/LOG.$lastLog\n"); - unlink("$TopDir/log/LOG.$lastLog"); + "Removing $LogDir/LOG.$lastLog\n"); + unlink("$LogDir/LOG.$lastLog"); } - if ( -f "$TopDir/log/LOG.$lastLog.z" ) { + if ( -f "$LogDir/LOG.$lastLog.z" ) { print(LOG $bpc->timeStamp, - "Removing $TopDir/log/LOG.$lastLog.z\n"); - unlink("$TopDir/log/LOG.$lastLog.z"); + "Removing $LogDir/LOG.$lastLog.z\n"); + unlink("$LogDir/LOG.$lastLog.z"); } print(LOG $bpc->timeStamp, "Aging LOG files, LOG -> LOG.0 -> " . "LOG.1 -> ... -> LOG.$lastLog\n"); @@ -820,18 +821,18 @@ sub Main_Check_Timeout close(LOG); for ( my $i = $lastLog - 1 ; $i >= 0 ; $i-- ) { my $j = $i + 1; - rename("$TopDir/log/LOG.$i", "$TopDir/log/LOG.$j") - if ( -f "$TopDir/log/LOG.$i" ); - rename("$TopDir/log/LOG.$i.z", "$TopDir/log/LOG.$j.z") - if ( -f "$TopDir/log/LOG.$i.z" ); + rename("$LogDir/LOG.$i", "$LogDir/LOG.$j") + if ( -f "$LogDir/LOG.$i" ); + rename("$LogDir/LOG.$i.z", "$LogDir/LOG.$j.z") + if ( -f "$LogDir/LOG.$i.z" ); } # # Compress the log file LOG -> LOG.0.z (if enabled). # Otherwise, just rename LOG -> LOG.0. # - BackupPC::FileZIO->compressCopy("$TopDir/log/LOG", - "$TopDir/log/LOG.0.z", - "$TopDir/log/LOG.0", + BackupPC::FileZIO->compressCopy("$LogDir/LOG", + "$LogDir/LOG.0.z", + "$LogDir/LOG.0", $Conf{CompressLevel}, 1); LogFileOpen(); # @@ -1548,7 +1549,7 @@ sub Main_Check_Client_Messages ########################################################################### # -# Write the current status to $TopDir/log/status.pl +# Write the current status to $LogDir/status.pl # sub StatusWrite { @@ -1556,7 +1557,7 @@ sub StatusWrite [ \%Info, \%Status], [qw(*Info *Status)]); $dump->Indent(1); - if ( open(STATUS, ">", "$TopDir/log/status.pl") ) { + if ( open(STATUS, ">", "$LogDir/status.pl") ) { print(STATUS $dump->Dump); close(STATUS); } @@ -1757,7 +1758,7 @@ sub catch_signal close(LOG); LogFileOpen(); print(LOG "Fatal error: unhandled signal $SigName\n"); - unlink("$TopDir/log/BackupPC.pid"); + unlink("$LogDir/BackupPC.pid"); confess("Got new signal $SigName... quitting\n"); } else { $SigName = shift; @@ -1769,9 +1770,9 @@ sub catch_signal # sub LogFileOpen { - mkpath("$TopDir/log", 0, 0777) if ( !-d "$TopDir/log" ); - open(LOG, ">>$TopDir/log/LOG") - || die("Can't create LOG file $TopDir/log/LOG"); + mkpath($LogDir, 0, 0777) if ( !-d $LogDir ); + open(LOG, ">>$LogDir/LOG") + || die("Can't create LOG file $LogDir/LOG"); close(STDOUT); close(STDERR); open(STDOUT, ">&LOG"); @@ -1796,7 +1797,7 @@ sub ServerSocketInit print(LOG $bpc->timeStamp, "unix socket() failed: $!\n"); exit(1); } - my $sockFile = "$TopDir/log/BackupPC.sock"; + my $sockFile = "$LogDir/BackupPC.sock"; unlink($sockFile); if ( !bind(SERVER_UNIX, sockaddr_un($sockFile)) ) { print(LOG $bpc->timeStamp, "unix bind() failed: $!\n"); @@ -1879,7 +1880,7 @@ sub ServerShutdown } delete($Info{pid}); StatusWrite(); - unlink("$TopDir/log/BackupPC.pid"); + unlink("$LogDir/BackupPC.pid"); exit(1); } diff --git a/bin/BackupPC_archive b/bin/BackupPC_archive index 73425d5..e9ed33b 100644 --- a/bin/BackupPC_archive +++ b/bin/BackupPC_archive @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_archiveHost b/bin/BackupPC_archiveHost index ed481a7..bf9a506 100755 --- a/bin/BackupPC_archiveHost +++ b/bin/BackupPC_archiveHost @@ -38,7 +38,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_attribPrint b/bin/BackupPC_attribPrint index 47ecf79..c583654 100755 --- a/bin/BackupPC_attribPrint +++ b/bin/BackupPC_attribPrint @@ -61,7 +61,17 @@ if ( !-f $ARGV[0] ) { } my $attrib = BackupPC::Attrib->new({ compress => $Conf{CompressLevel} }); -if ( !$attrib->read(".", $ARGV[0]) ) { + +my($dir, $file); + +if ( $ARGV[0] =~ m{(.+)/(.+)} ) { + $dir = $1; + $file = $2; +} else { + $dir = $ARGV[0]; +} + +if ( !$attrib->read($dir, $file) ) { print STDERR "Cannot read attrib file $ARGV[0]\n"; exit(1); } diff --git a/bin/BackupPC_compressPool b/bin/BackupPC_compressPool index 1c577c4..6d03bfe 100755 --- a/bin/BackupPC_compressPool +++ b/bin/BackupPC_compressPool @@ -49,7 +49,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -69,6 +69,7 @@ use BackupPC::FileZIO; die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); $bpc->ChildInit(); my $TopDir = $bpc->TopDir(); +my $LogDir = $bpc->LogDir(); my $BinDir = $bpc->BinDir(); my %Conf = $bpc->Conf(); my $PoolDir = "$TopDir/pool"; @@ -399,8 +400,8 @@ sub compressHostFiles if ( !defined($host) ) { for ( my $i = 0 ; ; $i++ ) { - last if ( !-f "$TopDir/log/LOG.$i" ); - push(@Files, "$TopDir/log/LOG.$i"); + last if ( !-f "$LogDir/LOG.$i" ); + push(@Files, "$LogDir/LOG.$i"); } } else { @Backups = $bpc->BackupInfoRead($host); diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump index ef29ed8..72f992c 100755 --- a/bin/BackupPC_dump +++ b/bin/BackupPC_dump @@ -31,9 +31,9 @@ # full or incremental backup needs to be run. If no backup is # scheduled, or a ping to $client fails, then BackupPC_dump quits. # -# The backup is done using the selected XferMethod (smb, tar, rsync etc), -# extracting the dump into $TopDir/pc/$client/new. The xfer output is -# put into $TopDir/pc/$client/XferLOG. +# The backup is done using the selected XferMethod (smb, tar, rsync, +# backuppcd etc), extracting the dump into $TopDir/pc/$client/new. +# The xfer output is put into $TopDir/pc/$client/XferLOG. # # If the dump succeeds (based on parsing the output of the XferMethod): # - $TopDir/pc/$client/new is renamed to $TopDir/pc/$client/nnn, where @@ -70,7 +70,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -85,6 +85,7 @@ use BackupPC::Storage; use BackupPC::Xfer::Smb; use BackupPC::Xfer::Tar; use BackupPC::Xfer::Rsync; +use BackupPC::Xfer::BackupPCd; use Socket; use File::Path; use File::Find; @@ -497,6 +498,8 @@ if ( $Conf{XferMethod} eq "tar" ) { $ShareNames = $Conf{TarShareName}; } elsif ( $Conf{XferMethod} eq "rsync" || $Conf{XferMethod} eq "rsyncd" ) { $ShareNames = $Conf{RsyncShareName}; +} elsif ( $Conf{XferMethod} eq "backuppcd" ) { + $ShareNames = $Conf{BackupPCdShareName}; } else { $ShareNames = $Conf{SmbShareName}; } @@ -542,6 +545,18 @@ for my $shareName ( @$ShareNames ) { UserCommandRun("DumpPostUserCmd") if ( $NeedPostCmd ); exit(1); } + } elsif ( $Conf{XferMethod} eq "backuppcd" ) { + # + # Use backuppcd as the transport program. + # + if ( !defined($xfer = BackupPC::Xfer::BackupPCd->new($bpc)) ) { + my $errStr = BackupPC::Xfer::BackupPCd::errStr; + print(LOG $bpc->timeStamp, "dump failed: $errStr\n"); + print("dump failed: $errStr\n"); + UserCommandRun("DumpPostShareCmd", $shareName) if ( $NeedPostCmd ); + UserCommandRun("DumpPostUserCmd") if ( $NeedPostCmd ); + exit(1); + } } else { # # Default is to use smbclient (smb) as the transport program. diff --git a/bin/BackupPC_link b/bin/BackupPC_link index b3cc51a..e4a7b22 100755 --- a/bin/BackupPC_link +++ b/bin/BackupPC_link @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_nightly b/bin/BackupPC_nightly index 9f6f4eb..a53e592 100755 --- a/bin/BackupPC_nightly +++ b/bin/BackupPC_nightly @@ -55,7 +55,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_restore b/bin/BackupPC_restore index 2015df8..8f78316 100755 --- a/bin/BackupPC_restore +++ b/bin/BackupPC_restore @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -43,6 +43,7 @@ use BackupPC::FileZIO; use BackupPC::Xfer::Smb; use BackupPC::Xfer::Tar; use BackupPC::Xfer::Rsync; +use BackupPC::Xfer::BackupPCd; use Socket; use File::Path; @@ -224,6 +225,16 @@ if ( $Conf{XferMethod} eq "tar" ) { $stat{hostError} = $errStr; exit(RestoreCleanup($client)); } +} elsif ( $Conf{XferMethod} eq "backuppcd" ) { + # + # Use backuppcd as the transport program. + # + if ( !defined($xfer = BackupPC::Xfer::BackupPCd->new($bpc)) ) { + my $errStr = BackupPC::Xfer::BackupPCd->errStr; + UserCommandRun("RestorePostUserCmd") if ( $NeedPostCmd ); + $stat{hostError} = $errStr; + exit(RestoreCleanup($client)); + } } else { # # Default is to use smbclient (smb) as the transport program. diff --git a/bin/BackupPC_sendEmail b/bin/BackupPC_sendEmail index 3a1200d..8357bdc 100755 --- a/bin/BackupPC_sendEmail +++ b/bin/BackupPC_sendEmail @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -46,10 +46,11 @@ use BackupPC::FileZIO; use Data::Dumper; use Getopt::Std; use DirHandle (); -use vars qw($Lang $TopDir $BinDir %Conf); +use vars qw($Lang $TopDir $BinDir $LogDir %Conf); die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); $TopDir = $bpc->TopDir(); +$LogDir = $bpc->LogDir(); $BinDir = $bpc->BinDir(); %Conf = $bpc->Conf(); $Lang = $bpc->Lang(); @@ -57,7 +58,7 @@ $Lang = $bpc->Lang(); $bpc->ChildInit(); use vars qw(%UserEmailInfo); -do "$TopDir/log/UserEmailInfo.pl"; +do "$LogDir/UserEmailInfo.pl"; my %opts; if ( !getopts("t", \%opts) || @ARGV != 0 ) { @@ -286,7 +287,7 @@ if ( !$opts{t} ) { my $dumpStr = Data::Dumper->Dump( [\%UserEmailInfo], [qw(*UserEmailInfo)]); - if ( open(HOST, ">", "$TopDir/log/UserEmailInfo.pl") ) { + if ( open(HOST, ">", "$LogDir/UserEmailInfo.pl") ) { binmode(HOST); print(HOST $dumpStr); close(HOST); diff --git a/bin/BackupPC_serverMesg b/bin/BackupPC_serverMesg index d5a8f55..93b1f9b 100755 --- a/bin/BackupPC_serverMesg +++ b/bin/BackupPC_serverMesg @@ -43,7 +43,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_tarCreate b/bin/BackupPC_tarCreate index 8d8d134..97b9878 100755 --- a/bin/BackupPC_tarCreate +++ b/bin/BackupPC_tarCreate @@ -53,7 +53,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_tarExtract b/bin/BackupPC_tarExtract index 1686ffd..55217b9 100755 --- a/bin/BackupPC_tarExtract +++ b/bin/BackupPC_tarExtract @@ -27,7 +27,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -260,7 +260,7 @@ sub TarReadFileInfo from_to($name, $Conf{ClientCharset}, "utf8"); from_to($linkname, $Conf{ClientCharset}, "utf8"); } - printf("File now $name (hex: %s)\n", unpack("H*", $name)); + # printf("File now $name (hex: %s)\n", unpack("H*", $name)); $name =~ s{^\./+}{}; $name =~ s{/+\.?$}{}; diff --git a/bin/BackupPC_tarPCCopy b/bin/BackupPC_tarPCCopy index efb96a8..a7b0e7a 100755 --- a/bin/BackupPC_tarPCCopy +++ b/bin/BackupPC_tarPCCopy @@ -460,11 +460,12 @@ sub TarWriteFile } $f->close(); my $md5 = Digest::MD5->new; + my $len = length($dataMD5); + $hdr->{realSize} = $len if ( $hdr->{type} != BPC_FTYPE_FILE ); if ( $hdr->{realSize} < 1048576 && length($dataMD5) != $hdr->{realSize} ) { - printf(STDERR "File $hdr->{fullPath} has bad size" - . " (expect $hdr->{realSize}, got %d)\n", - length($dataMD5)); + print(STDERR "File $hdr->{fullPath} has bad size" + . " (expect $hdr->{realSize}, got $len)\n"); } else { my $digest = $bpc->Buffer2MD5($md5, $hdr->{realSize}, \$dataMD5); diff --git a/bin/BackupPC_trashClean b/bin/BackupPC_trashClean index 69cde02..df733e6 100755 --- a/bin/BackupPC_trashClean +++ b/bin/BackupPC_trashClean @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_zcat b/bin/BackupPC_zcat index 9e21790..4b08bec 100755 --- a/bin/BackupPC_zcat +++ b/bin/BackupPC_zcat @@ -32,7 +32,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_zipCreate b/bin/BackupPC_zipCreate index 82061af..51683fb 100755 --- a/bin/BackupPC_zipCreate +++ b/bin/BackupPC_zipCreate @@ -52,7 +52,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/cgi-bin/BackupPC_Admin b/cgi-bin/BackupPC_Admin index 0d5ec32..cd2e4a9 100755 --- a/cgi-bin/BackupPC_Admin +++ b/cgi-bin/BackupPC_Admin @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/conf/config.pl b/conf/config.pl index 03c28b5..d0fdc1f 100644 --- a/conf/config.pl +++ b/conf/config.pl @@ -740,6 +740,17 @@ $Conf{XferMethod} = 'smb'; # $Conf{XferLogLevel} = 1; +# +# Filename charset encoding on the client. BackupPC uses utf8 +# on the server for filename encoding. If this is empty, then +# utf8 is assumed and client filenames will not be modified. If set +# to a different encoding then filenames will be re-encoded in utf8. +# A typical WinXX encoding for latin1/western europe is 'cp1252'. +# Do "perldoc Encode::Supported" to see the list of possible charset +# values, and also see http://czyborra.com/charsets/iso8859.html. +# +$Conf{ClientCharset} = ''; + # # Name of the host share that is backed up when using SMB. This can be a # string or an array of strings if there are multiple shares per host. @@ -1146,6 +1157,63 @@ $Conf{RsyncRestoreArgs} = [ # ]; +# +# Share name to backup. For $Conf{XferMethod} = "backuppcd" this should +# be a file system path, eg '/' or '/home'. +# +# This can also be a list of multiple file system paths or modules. +# (Can it??) +# +# $Conf{BackupPCdShareName} = ['/', '/var', '/data', '/boot']; +# +$Conf{BackupPCdShareName} = '/'; + +# +# Path to backuppcd executable on the server +# +$Conf{BackupPCdPath} = '/usr/bin/backuppcd'; + +# +# Full command to run backuppcd on the server to backup a given +# client machine. The following variables are substituted at +# run-time (TODO: update this list) +# +# $host host name being backed up +# $hostIP host's IP address +# $shareName share name to backup (ie: top-level directory path) +# $backuppcdPath same as $Conf{BackupPCdPath} +# $sshPath same as $Conf{SshPath} +# +# This setting only matters if $Conf{XferMethod} = 'backuppcd'. +# +# Arguments to backupcpd are: +# +# - the host name to backup +# - the share name to backup +# - the directory where the pool is +# - the directory where the last run was (NOT DONE YET) +# - a boolean value indicating whether or not the pool is +# compressed or not +# - the directory where the new run should occur (currently it assumes ".") +# +$Conf{BackupPCdCmd} = '$bpcdPath $host $shareName $poolDir XXXX $poolCompress $topDir/pc/$client/new'; + +# +# Full command to run backuppcd on the server for restore to a +# client machine. The following variables are substituted at +# run-time (TODO: update this list) +# +# $host host name being backed up +# $hostIP host's IP address +# $shareName share name to backup (ie: top-level directory path) +# $backuppcdPath same as $Conf{BackupPCdPath} +# $sshPath same as $Conf{SshPath} +# +# This setting only matters if $Conf{XferMethod} = 'backuppcd'. +# +$Conf{BackupPCdRestoreCmd} = '$bpcdPath TODO'; + + # # Archive Destination # diff --git a/configure.pl b/configure.pl index 0b8e030..b19f83d 100755 --- a/configure.pl +++ b/configure.pl @@ -19,7 +19,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2004 Craig Barratt +# Copyright (C) 2001-2006 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 @@ -78,9 +78,7 @@ EOF } my %opts; -$opts{fhs} = 1; $opts{"set-perms"} = 1; -$opts{"backuppc-user"} = "backuppc"; if ( !GetOptions( \%opts, "batch", @@ -131,7 +129,7 @@ EOF # # InstallDir which includes subdirs bin, lib, doc # -# With FSH enabled (which is the default for new installations): +# With FHS enabled (which is the default for new installations): # # /etc/BackupPC/config.pl main config file (was $TopDir/conf/config.pl) # /etc/BackupPC/hosts hosts file (was $TopDir/conf/hosts) @@ -155,15 +153,16 @@ EOF # my $ConfigPath = ""; while ( 1 ) { - if ( $opts{fhs} && -f "/etc/BackupPC/config.pl" ) { + if ( -f "/etc/BackupPC/config.pl" ) { $ConfigPath = "/etc/BackupPC/config.pl"; + $opts{fhs} = 1 if ( !defined($opts{fhs}) ); } else { $ConfigPath = prompt("--> Full path to existing main config.pl", $ConfigPath, "config-path"); } last if ( $ConfigPath eq "" - || ($ConfigPath =~ /^\// && -r $ConfigPath && -w $ConfigPath) ); + || ($ConfigPath =~ /^\// && -f $ConfigPath && -w $ConfigPath) ); my $problem = "is not an absolute path"; $problem = "is not writable" if ( !-w $ConfigPath ); $problem = "is not readable" if ( !-r $ConfigPath ); @@ -175,6 +174,8 @@ while ( 1 ) { exit(1); } } +$opts{fhs} = 1 if ( !defined($opts{fhs}) && $ConfigPath eq "" ); +$opts{fhs} = 0 if ( !defined($opts{fhs}) ); my $bpc; if ( $ConfigPath ne "" && -r $ConfigPath ) { @@ -208,7 +209,6 @@ if ( $opts{fhs} ) { $Conf{ConfDir} ||= "/etc/BackupPC"; $Conf{InstallDir} ||= "/usr/local/BackupPC"; $Conf{LogDir} ||= "/var/log/BackupPC"; - $Conf{StatusDir} ||= "/var/lib/BackupPC"; } # @@ -497,7 +497,9 @@ exit unless prompt("--> Do you want to continue?", "y") =~ /y/i; # foreach my $dir ( qw(bin doc lib/BackupPC/CGI + lib/BackupPC/Config lib/BackupPC/Lang + lib/BackupPC/Storage lib/BackupPC/Xfer lib/BackupPC/Zip ) ) { @@ -535,7 +537,6 @@ foreach my $dir ( ( "$Conf{TopDir}/trash", "$Conf{ConfDir}", "$Conf{LogDir}", - "$Conf{StatusDir}", ) ) { mkpath("$DestDir/$dir", 0, 0750) if ( !-d "$DestDir/$dir" ); if ( !-d "$DestDir/$dir" @@ -557,24 +558,12 @@ foreach my $prog ( qw(BackupPC BackupPC_dump BackupPC_link BackupPC_nightly printf("Installing library in $DestDir$Conf{InstallDir}/lib\n"); foreach my $lib ( qw( - BackupPC/Lib.pm BackupPC/FileZIO.pm BackupPC/Attrib.pm BackupPC/PoolWrite.pm + BackupPC/Lib.pm + BackupPC/Storage.pm BackupPC/View.pm - BackupPC/Xfer/Archive.pm - BackupPC/Xfer/Tar.pm - BackupPC/Xfer/Smb.pm - BackupPC/Xfer/Rsync.pm - BackupPC/Xfer/RsyncDigest.pm - BackupPC/Xfer/RsyncFileIO.pm - BackupPC/Zip/FileMember.pm - BackupPC/Lang/en.pm - BackupPC/Lang/fr.pm - BackupPC/Lang/es.pm - BackupPC/Lang/de.pm - BackupPC/Lang/it.pm - BackupPC/Lang/nl.pm BackupPC/CGI/AdminOptions.pm BackupPC/CGI/Archive.pm BackupPC/CGI/ArchiveInfo.pm @@ -595,6 +584,22 @@ foreach my $lib ( qw( BackupPC/CGI/StopServer.pm BackupPC/CGI/Summary.pm BackupPC/CGI/View.pm + BackupPC/Config/Meta.pm + BackupPC/Lang/en.pm + BackupPC/Lang/fr.pm + BackupPC/Lang/es.pm + BackupPC/Lang/de.pm + BackupPC/Lang/it.pm + BackupPC/Lang/nl.pm + BackupPC/Storage/Text.pm + BackupPC/Xfer/Archive.pm + BackupPC/Xfer/BackupPCd.pm + BackupPC/Xfer/Tar.pm + BackupPC/Xfer/Smb.pm + BackupPC/Xfer/Rsync.pm + BackupPC/Xfer/RsyncDigest.pm + BackupPC/Xfer/RsyncFileIO.pm + BackupPC/Zip/FileMember.pm ) ) { InstallFile("lib/$lib", "$DestDir$Conf{InstallDir}/lib/$lib", 0444); } @@ -882,6 +887,7 @@ sub InstallFile s/__LOGDIR__/$Conf{LogDir}/g; s/__CONFDIR__/$Conf{ConfDir}/g; s/__TOPDIR__/$Conf{TopDir}/g; + s/__USEFHS__/$opts{fhs}/g; s/__BACKUPPCUSER__/$Conf{BackupPCUser}/g; s/__CGIDIR__/$Conf{CgiDir}/g; if ( $first && /^#.*bin\/perl/ ) { @@ -1135,8 +1141,9 @@ final locations. =item B<--fhs> Use locations specified by the Filesystem Hierarchy Standard -for installing BackupPC. This is enabled by default. To -use the pre-3.0 installation locations, specify --no-fhs. +for installing BackupPC. This is enabled by default for new +installatios. To use the pre-3.0 installation locations, +specify --no-fhs. =item B<--help|?> diff --git a/lib/BackupPC/Attrib.pm b/lib/BackupPC/Attrib.pm index d48d85e..e38f7cb 100644 --- a/lib/BackupPC/Attrib.pm +++ b/lib/BackupPC/Attrib.pm @@ -30,7 +30,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/AdminOptions.pm b/lib/BackupPC/CGI/AdminOptions.pm index 9663025..e56d078 100644 --- a/lib/BackupPC/CGI/AdminOptions.pm +++ b/lib/BackupPC/CGI/AdminOptions.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Archive.pm b/lib/BackupPC/CGI/Archive.pm index 6fbd2b5..b0b87cc 100644 --- a/lib/BackupPC/CGI/Archive.pm +++ b/lib/BackupPC/CGI/Archive.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/ArchiveInfo.pm b/lib/BackupPC/CGI/ArchiveInfo.pm index 4f7b2c8..36c0839 100644 --- a/lib/BackupPC/CGI/ArchiveInfo.pm +++ b/lib/BackupPC/CGI/ArchiveInfo.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Browse.pm b/lib/BackupPC/CGI/Browse.pm index e0c3346..7f89270 100644 --- a/lib/BackupPC/CGI/Browse.pm +++ b/lib/BackupPC/CGI/Browse.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/DirHistory.pm b/lib/BackupPC/CGI/DirHistory.pm index 30162f0..3a9b0c0 100644 --- a/lib/BackupPC/CGI/DirHistory.pm +++ b/lib/BackupPC/CGI/DirHistory.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/EmailSummary.pm b/lib/BackupPC/CGI/EmailSummary.pm index 355c171..806f740 100644 --- a/lib/BackupPC/CGI/EmailSummary.pm +++ b/lib/BackupPC/CGI/EmailSummary.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/GeneralInfo.pm b/lib/BackupPC/CGI/GeneralInfo.pm index 6838d58..472cb1b 100644 --- a/lib/BackupPC/CGI/GeneralInfo.pm +++ b/lib/BackupPC/CGI/GeneralInfo.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/HostInfo.pm b/lib/BackupPC/CGI/HostInfo.pm index dbb53d7..5c20ef7 100644 --- a/lib/BackupPC/CGI/HostInfo.pm +++ b/lib/BackupPC/CGI/HostInfo.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/LOGlist.pm b/lib/BackupPC/CGI/LOGlist.pm index 99e405c..18cbdcd 100644 --- a/lib/BackupPC/CGI/LOGlist.pm +++ b/lib/BackupPC/CGI/LOGlist.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -53,7 +53,7 @@ sub action $url0 = "&host=${EscURI($host)}"; $hdr = "for host $host"; } else { - $root = "$TopDir/log/LOG"; + $root = "$LogDir/LOG"; $url0 = ""; $hdr = ""; } diff --git a/lib/BackupPC/CGI/Lib.pm b/lib/BackupPC/CGI/Lib.pm index dcabdb9..bec4ea8 100644 --- a/lib/BackupPC/CGI/Lib.pm +++ b/lib/BackupPC/CGI/Lib.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -44,7 +44,7 @@ require Exporter; use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS ); -use vars qw($Cgi %In $MyURL $User %Conf $TopDir $BinDir $bpc); +use vars qw($Cgi %In $MyURL $User %Conf $TopDir $LogDir $BinDir $bpc); use vars qw(%Status %Info %Jobs @BgQueue @UserQueue @CmdQueue %QueueLen %StatusHost); use vars qw($Hosts $HostsMTime $ConfigMTime $PrivAdmin); @@ -76,7 +76,7 @@ use vars qw($Lang); NavLink h1 h2 - $Cgi %In $MyURL $User %Conf $TopDir $BinDir $bpc + $Cgi %In $MyURL $User %Conf $TopDir $LogDir $BinDir $bpc %Status %Info %Jobs @BgQueue @UserQueue @CmdQueue %QueueLen %StatusHost $Hosts $HostsMTime $ConfigMTime $PrivAdmin @@ -97,6 +97,7 @@ sub NewRequest ErrorExit($Lang->{BackupPC__Lib__new_failed__check_apache_error_log}) if ( !($bpc = BackupPC::Lib->new(undef, undef, undef, 1)) ); $TopDir = $bpc->TopDir(); + $LogDir = $bpc->LogDir(); $BinDir = $bpc->BinDir(); %Conf = $bpc->Conf(); $Lang = $bpc->Lang(); @@ -309,9 +310,9 @@ sub GetStatusInfo sub ReadUserEmailInfo { - if ( (stat("$TopDir/log/UserEmailInfo.pl"))[9] != $UserEmailInfoMTime ) { - do "$TopDir/log/UserEmailInfo.pl"; - $UserEmailInfoMTime = (stat("$TopDir/log/UserEmailInfo.pl"))[9]; + if ( (stat("$LogDir/UserEmailInfo.pl"))[9] != $UserEmailInfoMTime ) { + do "$LogDir/UserEmailInfo.pl"; + $UserEmailInfoMTime = (stat("$LogDir/UserEmailInfo.pl"))[9]; } } diff --git a/lib/BackupPC/CGI/Queue.pm b/lib/BackupPC/CGI/Queue.pm index 8965ce6..a6e6294 100644 --- a/lib/BackupPC/CGI/Queue.pm +++ b/lib/BackupPC/CGI/Queue.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/ReloadServer.pm b/lib/BackupPC/CGI/ReloadServer.pm index 37c403d..97d027d 100644 --- a/lib/BackupPC/CGI/ReloadServer.pm +++ b/lib/BackupPC/CGI/ReloadServer.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Restore.pm b/lib/BackupPC/CGI/Restore.pm index 0310c63..e494ace 100644 --- a/lib/BackupPC/CGI/Restore.pm +++ b/lib/BackupPC/CGI/Restore.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/RestoreFile.pm b/lib/BackupPC/CGI/RestoreFile.pm index d8d1b95..74501c8 100644 --- a/lib/BackupPC/CGI/RestoreFile.pm +++ b/lib/BackupPC/CGI/RestoreFile.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/RestoreInfo.pm b/lib/BackupPC/CGI/RestoreInfo.pm index 733956e..d190750 100644 --- a/lib/BackupPC/CGI/RestoreInfo.pm +++ b/lib/BackupPC/CGI/RestoreInfo.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/StartServer.pm b/lib/BackupPC/CGI/StartServer.pm index 0906cb7..3b0947e 100644 --- a/lib/BackupPC/CGI/StartServer.pm +++ b/lib/BackupPC/CGI/StartServer.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/StartStopBackup.pm b/lib/BackupPC/CGI/StartStopBackup.pm index a07efeb..8e2f6a6 100644 --- a/lib/BackupPC/CGI/StartStopBackup.pm +++ b/lib/BackupPC/CGI/StartStopBackup.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/StopServer.pm b/lib/BackupPC/CGI/StopServer.pm index 2c3bc36..6fb171d 100644 --- a/lib/BackupPC/CGI/StopServer.pm +++ b/lib/BackupPC/CGI/StopServer.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Summary.pm b/lib/BackupPC/CGI/Summary.pm index 71bbdeb..dbf1325 100644 --- a/lib/BackupPC/CGI/Summary.pm +++ b/lib/BackupPC/CGI/Summary.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/View.pm b/lib/BackupPC/CGI/View.pm index f6cc637..5efa6a2 100644 --- a/lib/BackupPC/CGI/View.pm +++ b/lib/BackupPC/CGI/View.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -94,7 +94,7 @@ sub action $file = "$TopDir/pc/$host/LOG$ext"; $linkHosts = 1; } else { - $file = "$TopDir/log/LOG$ext"; + $file = "$LogDir/LOG$ext"; $linkHosts = 1; } if ( $type ne "docs" && !$Privileged ) { diff --git a/lib/BackupPC/Config/Meta.pm b/lib/BackupPC/Config/Meta.pm index 3d651be..3001e45 100644 --- a/lib/BackupPC/Config/Meta.pm +++ b/lib/BackupPC/Config/Meta.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/FileZIO.pm b/lib/BackupPC/FileZIO.pm index a5359a0..0b23873 100644 --- a/lib/BackupPC/FileZIO.pm +++ b/lib/BackupPC/FileZIO.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.1, released 13 Mar 2005. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Lib.pm b/lib/BackupPC/Lib.pm index 6805642..251f909 100644 --- a/lib/BackupPC/Lib.pm +++ b/lib/BackupPC/Lib.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -60,37 +60,43 @@ sub new # Whether to use filesystem hierarchy standard for file layout. # If set, text config files are below /etc/BackupPC. # - my $useFSH = 0; + my $useFHS = 0; my $paths; + # + # Set defaults for $topDir and $installDir. + # + $topDir = '/tera0/backup/BackupPC' if ( $topDir eq "" ); + $installDir = '/usr/local/BackupPC' if ( $installDir eq "" ); + # # Pick some initial defaults. For FHS the only critical # path is the ConfDir, since we get everything else out # of the main config file. # - if ( $useFSH ) { + if ( $useFHS ) { $paths = { - useFSH => $useFSH, - TopDir => $topDir || '/data/BackupPC', - BinDir => $installDir ? "$installDir/bin" : '/usr/local/BackupPC/bin', - LibDir => $installDir ? "$installDir/lib" : '/usr/local/BackupPC/lib', - ConfDir => $confDir || '/etc/BackupPC', - LogDir => $topDir ? "$topDir/log" : '/var/log/BackupPC', + useFHS => $useFHS, + TopDir => $topDir, + BinDir => "$installDir/bin", + LibDir => "$installDir/lib", + ConfDir => $confDir eq "" ? '/etc/BackupPC' : $confDir, + LogDir => '/var/log/BackupPC', }; } else { $paths = { - useFSH => $useFSH, - TopDir => $topDir || '/data/BackupPC', - BinDir => $installDir ? "$installDir/bin" : '/usr/local/BackupPC/bin', - LibDir => $installDir ? "$installDir/lib" : '/usr/local/BackupPC/lib', - ConfDir => $topDir ? "$topDir/conf" : '/data/BackupPC/conf', - LogDir => $topDir ? "$topDir/log" : '/data/BackupPC/log', + useFHS => $useFHS, + TopDir => $topDir, + BinDir => "$installDir/bin", + LibDir => "$installDir/lib", + ConfDir => $confDir eq "" ? "$topDir/conf" : $confDir, + LogDir => "$topDir/log", }; } my $bpc = bless { %$paths, - Version => '2.1.0', + Version => '3.0.0alpha', }, $class; $bpc->{storage} = BackupPC::Storage->new($paths); @@ -505,7 +511,7 @@ sub ServerConnect # # First try the unix-domain socket # - my $sockFile = "$bpc->{TopDir}/log/BackupPC.sock"; + my $sockFile = "$bpc->{LogDir}/BackupPC.sock"; socket(*FH, PF_UNIX, SOCK_STREAM, 0) || return "unix socket: $!"; if ( !connect(*FH, sockaddr_un($sockFile)) ) { my $err = "unix connect: $!"; diff --git a/lib/BackupPC/PoolWrite.pm b/lib/BackupPC/PoolWrite.pm index 7360e7c..23eb788 100644 --- a/lib/BackupPC/PoolWrite.pm +++ b/lib/BackupPC/PoolWrite.pm @@ -56,7 +56,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Storage.pm b/lib/BackupPC/Storage.pm index 73d758e..0d066e5 100644 --- a/lib/BackupPC/Storage.pm +++ b/lib/BackupPC/Storage.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Storage/Text.pm b/lib/BackupPC/Storage/Text.pm index 286b6c0..18f5913 100644 --- a/lib/BackupPC/Storage/Text.pm +++ b/lib/BackupPC/Storage/Text.pm @@ -30,7 +30,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -103,7 +103,7 @@ sub BackupInfoWrite # # Write the file # - return $s->TextFileWrite("$s->{TopDir}/pc/$host", "backups", $contents); + return $s->TextFileWrite("$s->{TopDir}/pc/$host/backups", $contents); } sub RestoreInfoRead @@ -144,7 +144,7 @@ sub RestoreInfoWrite # # Write the file # - return $s->TextFileWrite("$s->{TopDir}/pc/$host", "restores", $contents); + return $s->TextFileWrite("$s->{TopDir}/pc/$host/restores", $contents); } sub ArchiveInfoRead @@ -185,7 +185,7 @@ sub ArchiveInfoWrite # # Write the file # - return $s->TextFileWrite("$s->{TopDir}/pc/$host", "archives", $contents); + return $s->TextFileWrite("$s->{TopDir}/pc/$host/archives", $contents); } # @@ -196,22 +196,24 @@ sub ArchiveInfoWrite # sub TextFileWrite { - my($s, $dir, $file, $contents) = @_; + my($s, $file, $contents) = @_; local(*FD, *LOCK); my($fileOk); + (my $dir = $file) =~ s{(.+)/(.+)}{$1}; + mkpath($dir, 0, 0775) if ( !-d $dir ); - if ( open(FD, ">", "$dir/$file.new") ) { + if ( open(FD, ">", "$file.new") ) { binmode(FD); print FD $contents; close(FD); # # verify the file # - if ( open(FD, "<", "$dir/$file.new") ) { + if ( open(FD, "<", "$file.new") ) { binmode(FD); if ( join("", ) ne $contents ) { - return "TextFileWrite: Failed to verify $dir/$file.new"; + return "TextFileWrite: Failed to verify $file.new"; } else { $fileOk = 1; } @@ -225,20 +227,34 @@ sub TextFileWrite $lock = 1; flock(LOCK, LOCK_EX); } - if ( -s "$dir/$file" ) { - unlink("$dir/$file.old") if ( -f "$dir/$file.old" ); - rename("$dir/$file", "$dir/$file.old") if ( -f "$dir/$file" ); + if ( -s "$file" ) { + unlink("$file.old") if ( -f "$file.old" ); + rename("$file", "$file.old") if ( -f "$file" ); } else { - unlink("$dir/$file") if ( -f "$dir/$file" ); + unlink("$file") if ( -f "$file" ); } - rename("$dir/$file.new", "$dir/$file") if ( -f "$dir/$file.new" ); + rename("$file.new", "$file") if ( -f "$file.new" ); close(LOCK) if ( $lock ); } else { - return "TextFileWrite: Failed to write $dir/$file.new"; + return "TextFileWrite: Failed to write $file.new"; } return; } +sub ConfigPath +{ + my($s, $host) = @_; + + return "$s->{ConfDir}/config.pl" if ( !defined($host) ); + if ( $s->{useFHS} ) { + return "$s->{ConfDir}/host/$host.pl"; + } else { + return "$s->{ConfDir}/$host.pl" + if ( $host ne "config" && -f "$s->{ConfDir}/$host.pl" ); + return "$s->{TopDir}/pc/$host/config.pl"; + } +} + sub ConfigDataRead { my($s, $host) = @_; @@ -248,15 +264,9 @@ sub ConfigDataRead # TODO: add lock # my $conf = {}; + my $configPath = $s->ConfigPath($host); - if ( defined($host) ) { - push(@configs, "$s->{TopDir}/conf/$host.pl") - if ( $host ne "config" && -f "$s->{TopDir}/conf/$host.pl" ); - push(@configs, "$s->{TopDir}/pc/$host/config.pl") - if ( -f "$s->{TopDir}/pc/$host/config.pl" ); - } else { - push(@configs, "$s->{TopDir}/conf/config.pl"); - } + push(@configs, $configPath) if ( -f $configPath ); foreach $config ( @configs ) { %Conf = (); if ( !defined($ret = do $config) && ($! || $@) ) { @@ -284,17 +294,16 @@ sub ConfigDataWrite { my($s, $host, $newConf) = @_; - my($confDir) = $host eq "" ? "$s->{TopDir}/conf" - : "$s->{TopDir}/pc/$host"; + my $configPath = $s->ConfigPath($host); - my($err, $contents) = $s->ConfigFileMerge("$confDir/config.pl", $newConf); + my($err, $contents) = $s->ConfigFileMerge("$configPath", $newConf); if ( defined($err) ) { return $err; } else { # # Write the file # - return $s->TextFileWrite($confDir, "config.pl", $contents); + return $s->TextFileWrite($configPath, $contents); } } @@ -376,11 +385,11 @@ sub ConfigFileMerge sub ConfigMTime { my($s) = @_; - return (stat("$s->{TopDir}/conf/config.pl"))[9]; + return (stat($s->ConfigPath()))[9]; } # -# Returns information from the host file in $s->{TopDir}/conf/hosts. +# Returns information from the host file in $s->{ConfDir}/hosts. # With no argument a ref to a hash of hosts is returned. Each # hash contains fields as specified in the hosts file. With an # argument a ref to a single hash is returned with information @@ -392,9 +401,9 @@ sub HostInfoRead my(%hosts, @hdr, @fld); local(*HOST_INFO, *LOCK); - flock(LOCK, LOCK_EX) if open(LOCK, "$s->{TopDir}/pc/$host/LOCK"); - if ( !open(HOST_INFO, "$s->{TopDir}/conf/hosts") ) { - print(STDERR "Can't open $s->{TopDir}/conf/hosts\n"); + flock(LOCK, LOCK_EX) if open(LOCK, "$s->{ConfDir}/LOCK"); + if ( !open(HOST_INFO, "$s->{ConfDir}/hosts") ) { + print(STDERR "Can't open $s->{ConfDir}/hosts\n"); close(LOCK); return {}; } @@ -436,7 +445,7 @@ sub HostInfoRead } # -# Writes new hosts information to the hosts file in $s->{TopDir}/conf/hosts. +# Writes new hosts information to the hosts file in $s->{ConfDir}/hosts. # With no argument a ref to a hash of hosts is returned. Each # hash contains fields as specified in the hosts file. With an # argument a ref to a single hash is returned with information @@ -448,8 +457,8 @@ sub HostInfoWrite my($gotHdr, @fld, $hostText, $contents); local(*HOST_INFO); - if ( !open(HOST_INFO, "$s->{TopDir}/conf/hosts") ) { - return "Can't open $s->{TopDir}/conf/hosts"; + if ( !open(HOST_INFO, "$s->{ConfDir}/hosts") ) { + return "Can't open $s->{ConfDir}/hosts"; } foreach my $host ( keys(%$hosts) ) { my $name = "$hosts->{$host}{host}"; @@ -493,7 +502,7 @@ sub HostInfoWrite # # Write and verify the new host file # - return $s->TextFileWrite("$s->{TopDir}/conf", "hosts", $contents); + return $s->TextFileWrite("$s->{ConfDir}/hosts", $contents); } # @@ -502,7 +511,7 @@ sub HostInfoWrite sub HostsMTime { my($s) = @_; - return (stat("$s->{TopDir}/conf/hosts"))[9]; + return (stat("$s->{ConfDir}/hosts"))[9]; } 1; diff --git a/lib/BackupPC/View.pm b/lib/BackupPC/View.pm index 6dc0f8d..e050544 100644 --- a/lib/BackupPC/View.pm +++ b/lib/BackupPC/View.pm @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/Archive.pm b/lib/BackupPC/Xfer/Archive.pm index 1186b97..964c620 100644 --- a/lib/BackupPC/Xfer/Archive.pm +++ b/lib/BackupPC/Xfer/Archive.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/BackupPCd.pm b/lib/BackupPC/Xfer/BackupPCd.pm new file mode 100644 index 0000000..e4e4b3c --- /dev/null +++ b/lib/BackupPC/Xfer/BackupPCd.pm @@ -0,0 +1,266 @@ +#============================================================= -*-perl-*- +# +# BackupPC::Xfer::BackupPCd package +# +# DESCRIPTION +# +# This library defines a BackupPC::Xfer::BackupPCd class for managing +# the backuppcd-based transport of backup data from the client. +# +# AUTHOR +# Craig Barratt +# +# COPYRIGHT +# Copyright (C) 2006 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +#======================================================================== +# +# Version 3.0.0alpha, released 23 Jan 2006. +# +# See http://backuppc.sourceforge.net. +# +#======================================================================== + +package BackupPC::Xfer::BackupPCd; + +use strict; + +sub new +{ + my($class, $bpc, $args) = @_; + + $args ||= {}; + my $t = bless { + bpc => $bpc, + conf => { $bpc->Conf }, + host => "", + hostIP => "", + shareName => "", + badFiles => [], + + # + # Various stats + # + byteCnt => 0, + fileCnt => 0, + xferErrCnt => 0, + xferBadShareCnt => 0, + xferBadFileCnt => 0, + xferOK => 0, + + # + # User's args + # + %$args, + }, $class; + + return $t; +} + +sub args +{ + my($t, $args) = @_; + + foreach my $arg ( keys(%$args) ) { + $t->{$arg} = $args->{$arg}; + } +} + +sub useTar +{ + return 0; +} + +sub start +{ + my($t) = @_; + my $bpc = $t->{bpc}; + my $conf = $t->{conf}; + my(@fileList, $bpcdCmd, $bpcdArgs, $logMsg, $incrDate, + $incrFlag, $restoreDir); + + # + # We add a slash to the share name we pass to bpcd + # + ($t->{shareNameSlash} = "$t->{shareName}/") =~ s{//+$}{/}; + + if ( $t->{type} eq "restore" ) { + $bpcdCmd = $conf->{BackupPCdRestoreCmd}; + $restoreDir = "$t->{shareName}/$t->{pathHdrDest}"; + $restoreDir =~ s{//+}{/}g; + $logMsg = "restore started below directory $t->{shareName}" + . " to host $t->{host}"; + } else { + if ( $t->{type} eq "full" ) { + if ( $t->{partialNum} ) { + $logMsg = "full backup started for directory $t->{shareName};" + . " updating partial $t->{partialNum}"; + } else { + $logMsg = "full backup started for directory $t->{shareName}"; + } + $incrFlag = 0; + } else { + # + # TODO: fix this message - just refer to the backup, not time? + # + $incrDate = $bpc->timeStamp($t->{lastFull} - 3600, 1); + $logMsg = "incr backup started back to $incrDate for directory" + . " $t->{shareName}"; + $incrFlag = 1; + } + $bpcdCmd = $conf->{BackupPCdCmd}; + } + + # + # Merge variables into $bpcdCmd + # + my $args = { + host => $t->{host}, + hostIP => $t->{hostIP}, + client => $t->{client}, + shareName => $t->{shareName}, + shareNameSlash => $t->{shareNameSlash}, + restoreDir => $restoreDir, + bpcdPath => $conf->{BackupPCdPath}, + sshPath => $conf->{SshPath}, + topDir => $bpc->TopDir(), + poolDir => $t->{compress} ? $bpc->{CPoolDir} : $bpc->{PoolDir}, + poolCompress => $t->{compress} + 0, + incrFlag => $incrFlag, + }; + $bpcdCmd = $bpc->cmdVarSubstitute($bpcdCmd, $args); + + $t->{bpcdCmd} = $bpcdCmd; + + delete($t->{_errStr}); + + return $logMsg; +} + +sub run +{ + my($t) = @_; + my $bpc = $t->{bpc}; + my $conf = $t->{conf}; + my($remoteSend, $remoteDir, $remoteDirDaemon); + my $error; + my $stats; + + # NO: alarm($conf->{ClientTimeout}); + + # + # Run backupcd command + # + my $str = "Running: " + . $t->{bpc}->execCmd2ShellCmd(@{$t->{bpcdCmd}}) + . "\n"; + $t->{XferLOG}->write(\$str); + + # + # + # + + $bpc->cmdSystemOrEvalLong($t->{bpcdCmd}, + sub { + # write stdout to the XferLOG + my($str) = @_; + $t->{XferLOG}->write(\$str); + }, + 0, # also catch stderr + $t->{pidHandler} + ); + + # + # TODO: generate sensible stats by parsing the output of + # backuppcd. Get error and fail status. + # + if ( !defined($error) && defined($stats) ) { + $t->{xferOK} = 1; + } else { + $t->{xferOK} = 0; + } + $t->{xferErrCnt} = $stats->{errorCnt}; + $t->{byteCnt} = $stats->{TotalFileSize}; + $t->{fileCnt} = $stats->{TotalFileCnt}; + my $str = "Done: $t->{fileCnt} files, $t->{byteCnt} bytes\n"; + $t->{XferLOG}->write(\$str); + + $t->{hostError} = $error if ( defined($error) ); + + if ( $t->{type} eq "restore" ) { + return ( + $t->{fileCnt}, + $t->{byteCnt}, + 0, + 0 + ); + } else { + return ( + 0, + $stats->{ExistFileCnt}, + $stats->{ExistFileSize}, + $stats->{ExistFileCompSize}, + $stats->{TotalFileCnt}, + $stats->{TotalFileSize} + ); + } +} + +sub abort +{ + my($t, $reason) = @_; + + # TODO + return 1; +} + +sub errStr +{ + my($t) = @_; + + return $t->{_errStr}; +} + +sub xferPid +{ + my($t) = @_; + + return (); +} + +# +# Returns a hash ref giving various status information about +# the transfer. +# +sub getStats +{ + my($t) = @_; + + return { map { $_ => $t->{$_} } + qw(byteCnt fileCnt xferErrCnt xferBadShareCnt xferBadFileCnt + xferOK hostAbort hostError lastOutputLine) + }; +} + +sub getBadFiles +{ + my($t) = @_; + + return @{$t->{badFiles}}; +} + +1; diff --git a/lib/BackupPC/Xfer/Rsync.pm b/lib/BackupPC/Xfer/Rsync.pm index 4088f17..8972a98 100644 --- a/lib/BackupPC/Xfer/Rsync.pm +++ b/lib/BackupPC/Xfer/Rsync.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/RsyncDigest.pm b/lib/BackupPC/Xfer/RsyncDigest.pm index b41aec4..6126938 100644 --- a/lib/BackupPC/Xfer/RsyncDigest.pm +++ b/lib/BackupPC/Xfer/RsyncDigest.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/RsyncFileIO.pm b/lib/BackupPC/Xfer/RsyncFileIO.pm index ef736e1..820f898 100644 --- a/lib/BackupPC/Xfer/RsyncFileIO.pm +++ b/lib/BackupPC/Xfer/RsyncFileIO.pm @@ -12,7 +12,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # @@ -736,23 +736,23 @@ sub logFileAction my $owner = "$f->{uid}/$f->{gid}"; my $type = (("", "p", "c", "", "d", "", "b", "", "", "", "l", "", "s")) [($f->{mode} & S_IFMT) >> 12]; - my $link; + my $name = $f->{name}; if ( ($f->{mode} & S_IFMT) == S_IFLNK ) { - $link = " -> $f->{link}"; - } if ( ($f->{mode} & S_IFMT) == S_IFREG + $name .= " -> $f->{link}"; + } elsif ( ($f->{mode} & S_IFMT) == S_IFREG && defined($f->{hlink}) && !$f->{hlink_self} ) { - $link = " -> $f->{hlink}"; + $name .= " -> $f->{hlink}"; } + $name =~ s/\n/\\n/g; - $fio->log(sprintf(" %-6s %1s%4o %9s %11.0f %s%s", + $fio->log(sprintf(" %-6s %1s%4o %9s %11.0f %s", $action, $type, $f->{mode} & 07777, $owner, $f->{size}, - $f->{name}, - $link)); + $name)); } # diff --git a/lib/BackupPC/Xfer/Smb.pm b/lib/BackupPC/Xfer/Smb.pm index 8a9ba26..03884a7 100644 --- a/lib/BackupPC/Xfer/Smb.pm +++ b/lib/BackupPC/Xfer/Smb.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/Tar.pm b/lib/BackupPC/Xfer/Tar.pm index 4ad5202..84ebcb2 100644 --- a/lib/BackupPC/Xfer/Tar.pm +++ b/lib/BackupPC/Xfer/Tar.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Zip/FileMember.pm b/lib/BackupPC/Zip/FileMember.pm index d9f47a9..aec0eb3 100644 --- a/lib/BackupPC/Zip/FileMember.pm +++ b/lib/BackupPC/Zip/FileMember.pm @@ -33,7 +33,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0alpha, released 23 Jan 2006. # # See http://backuppc.sourceforge.net. # diff --git a/makeDist b/makeDist index ee365d5..9b638fe 100755 --- a/makeDist +++ b/makeDist @@ -12,11 +12,15 @@ # # dist/BackupPC-$Version.tar.gz. # +# Often the language files are not up to date, and makeDist +# exits after complaining about the lang files being inconsistent. +# Use the -l option to turn off that behavior. +# # AUTHOR # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2004 Craig Barratt +# Copyright (C) 2001-2006 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 @@ -103,6 +107,7 @@ my @PerlSrc = qw( lib/BackupPC/Lang/pt_br.pm lib/BackupPC/Storage/Text.pm lib/BackupPC/Xfer/Archive.pm + lib/BackupPC/Xfer/BackupPCd.pm lib/BackupPC/Xfer/Smb.pm lib/BackupPC/Xfer/Tar.pm lib/BackupPC/Xfer/Rsync.pm @@ -273,14 +278,14 @@ sub InstallFile } elsif ( /^use lib ".*BackupPC\/lib";/ || /^use lib "\/home\/pcbackup\/install\/lib";/ ) { print OUT "use lib \"__INSTALLDIR__/lib\";\n"; - } elsif ( $file =~ /Lib.pm/ && /(.*TopDir *=> .*)'.*',/ ) { - print OUT "$1'__TOPDIR__',\n"; + } elsif ( $file =~ /Lib.pm/ && /^(\s*\$topDir\s*=\s*)'.*'(\s*if\s.*)/ ) { + print OUT "$1'__TOPDIR__'$2\n"; + } elsif ( $file =~ /Lib.pm/ && /^(\s*\$installDir\s*=\s*)'.*'(\s*if\s.*)/ ) { + print OUT "$1'__INSTALLDIR__'$2\n"; + } elsif ( $file =~ /Lib.pm/ && /^(\s*my \$useFHS\s*=\s*)\d;/ ) { + print OUT "${1}__USEFHS__;\n"; } elsif ( $file =~ /Lib.pm/ && /(.*Version *=> .*)'[\w\d\.]+',/ ) { print OUT "$1'$Version',\n"; - } elsif ( $file =~ /Lib.pm/ && /(.*BinDir *=> .*)'.*',/ ) { - print OUT "$1'__INSTALLDIR__',\n"; - } elsif ( $file =~ /Lib.pm/ && /(.*LibDir *=> .*)'.*',/ ) { - print OUT "$1'__INSTALLDIR__',\n"; } elsif ( $file =~ /BackupPC_Admin/ && /(my *\$installDir *= *)'.*'/ ) { print OUT "$1'__INSTALLDIR__/lib';\n"; } else { -- 2.20.1