From 2726b96b1a7026dc3f82250afbfe5ae27ab1c75f Mon Sep 17 00:00:00 2001 From: cbarratt Date: Sun, 21 Oct 2007 18:16:42 +0000 Subject: [PATCH 1/1] * Add run-time check that IO::Dirent is functioning correctly, reported by Doug Lytle. * Added comment to Cmd settings in conf/config.pl that they are not executed by a shell, as suggested by Erik van Linstee. * Added undefIfEmpty => 1 to lib/BackupPC/Config/Meta.pm for RsyncRestoreArgs, TarClientRestoreCmd and SmbClientRestoreCmd so that restores can be disabled by clear these fields in the CGI editor. Patch supplied by Stephen Joyce * Replaced the FAQ link with Wiki in the navigation bar and added mention of the Wiki to the documentation. Since these navigation bar links are specified in the config file, upgrades will keep the old FAQ link. The FAQ opening page will have a prominent link to the Wiki. --- conf/config.pl | 60 +++++++++++++++++++++++++++++++++++-- doc-src/BackupPC.pod | 23 +++++++++----- lib/BackupPC/Config/Meta.pm | 21 ++++++------- lib/BackupPC/Lib.pm | 15 +++++++++- makeDist | 4 +-- 5 files changed, 100 insertions(+), 23 deletions(-) diff --git a/conf/config.pl b/conf/config.pl index 7113463..411138c 100644 --- a/conf/config.pl +++ b/conf/config.pl @@ -207,6 +207,10 @@ $Conf{DfPath} = ''; # $dfPath path to df ($Conf{DfPath}) # $topDir top-level BackupPC data directory # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{DfCmd} = '$dfPath $topDir'; # @@ -332,6 +336,10 @@ $Conf{PerlModuleLoad} = undef; # . ' $serverInitdPath start' # . ' < /dev/null >& /dev/null'; # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{ServerInitdPath} = ''; $Conf{ServerInitdStartCmd} = ''; @@ -938,6 +946,10 @@ $Conf{SmbClientPath} = ''; # $X_option exclude option (if $fileList is an exclude list) # $timeStampFile start time for incremental dump # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{SmbClientFullCmd} = '$smbClientPath \\\\$host\\$shareName' . ' $I_option -U $userName -E -N -d 1' . ' -c tarmode\\ full -Tc$X_option - $fileList'; @@ -948,6 +960,10 @@ $Conf{SmbClientFullCmd} = '$smbClientPath \\\\$host\\$shareName' # # Same variable substitutions are applied as $Conf{SmbClientFullCmd}. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{SmbClientIncrCmd} = '$smbClientPath \\\\$host\\$shareName' . ' $I_option -U $userName -E -N -d 1' . ' -c tarmode\\ full -TcN$X_option $timeStampFile - $fileList'; @@ -962,6 +978,10 @@ $Conf{SmbClientIncrCmd} = '$smbClientPath \\\\$host\\$shareName' # You should set $Conf{SmbClientRestoreCmd} to undef and the # corresponding CGI restore option will be removed. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{SmbClientRestoreCmd} = '$smbClientPath \\\\$host\\$shareName' . ' $I_option -U $userName -E -N -d 1' . ' -c tarmode\\ full -Tx -'; @@ -1032,6 +1052,10 @@ $Conf{TarShareName} = '/'; # # This setting only matters if $Conf{XferMethod} = 'tar'. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{TarClientCmd} = '$sshPath -q -x -n -l root $host' . ' env LC_ALL=C $tarPath -c -v -f - -C $shareName+' . ' --totals'; @@ -1089,6 +1113,10 @@ $Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList+'; # $Conf{TarClientRestoreCmd} to undef and the corresponding CGI # restore option will be removed. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{TarClientRestoreCmd} = '$sshPath -q -x -l root $host' . ' env LC_ALL=C $tarPath -x -p --numeric-owner --same-owner' . ' -v -f - -C $shareName+'; @@ -1138,6 +1166,10 @@ $Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+'; # # This setting only matters if $Conf{XferMethod} = 'rsync'. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+'; # @@ -1345,6 +1377,10 @@ $Conf{BackupPCdCmd} = '$bpcdPath $host $shareName $poolDir XXXX $poolCompress $t # # This setting only matters if $Conf{XferMethod} = 'backuppcd'. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{BackupPCdRestoreCmd} = '$bpcdPath TODO'; @@ -1413,6 +1449,10 @@ $Conf{ArchiveSplit} = 0; # $archiveloc The location to put the archive # $parfile The amount of parity data to create (percentage) # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{ArchiveClientCmd} = '$Installdir/bin/BackupPC_archiveHost' . ' $tarCreatePath $splitpath $parpath $host $backupnumber' . ' $compression $compext $splitsize $archiveloc $parfile *'; @@ -1442,6 +1482,10 @@ $Conf{NmbLookupPath} = ''; # This command is only used for DHCP hosts: given an IP address, this # command should try to find its NetBios name. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{NmbLookupCmd} = '$nmbLookupPath -A $host'; # @@ -1469,6 +1513,10 @@ $Conf{NmbLookupCmd} = '$nmbLookupPath -A $host'; # Experiment manually for your site to see what form of nmblookup command # works. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{NmbLookupFindHostCmd} = '$nmbLookupPath $host'; # @@ -1502,6 +1550,10 @@ $Conf{PingPath} = ''; # exit status (0 even on failure). Replace with "ping $host 1", which # gets the correct exit status but we don't get the round-trip time. # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{PingCmd} = '$pingPath -c 1 $host'; # @@ -1648,6 +1700,10 @@ $Conf{MaxOldPerPCLogFiles} = 12; # $type set to "archive" # $cmdType set to ArchivePreUserCmd or ArchivePostUserCmd # +# Note: all Cmds are executed directly without a shell, so the prog name +# needs to be a full path and you can't include shell syntax like +# redirection and pipes; put that in a script if you need it. +# $Conf{DumpPreUserCmd} = undef; $Conf{DumpPostUserCmd} = undef; $Conf{DumpPreShareCmd} = undef; @@ -1938,8 +1994,8 @@ $Conf{CgiNavBarLinks} = [ lname => "Documentation", # actually displays $Lang->{Documentation} }, { - link => "http://backuppc.sourceforge.net/faq", - name => "FAQ", # displays literal "FAQ" + link => "http://backuppc.wiki.sourceforge.net", + name => "Wiki", # displays literal "Wiki" }, { link => "http://backuppc.sourceforge.net", diff --git a/doc-src/BackupPC.pod b/doc-src/BackupPC.pod index f3248bd..ec1ea8d 100644 --- a/doc-src/BackupPC.pod +++ b/doc-src/BackupPC.pod @@ -223,9 +223,14 @@ The SourceForge project page is at: This page has links to the current releases of BackupPC. -=item BackupPC FAQ +=item BackupPC Wiki -BackupPC has a FAQ at L. +BackupPC has a Wiki at L. +Everyone is encouraged to contribute to the Wiki. Anyone with +a SourceForge account can edit the Wiki. + +The old FAQ is at L, but +is deprecated in favor of the Wiki. =item Mailing lists @@ -321,9 +326,10 @@ time and money) for marketing, PR and advertising, so it's up to all of you! Feel free to vote for BackupPC at L. -Also, everyone is encouraged to contribute patches, bug reports, feature -and design suggestions, new code, FAQs, and documentation corrections or -improvements. Answering questions on the mailing list is a big help too. +Also, everyone is encouraged to contribute patches, bug reports, +feature and design suggestions, new code, Wiki additions (you can +do those directly) and documentation corrections or improvements. +Answering questions on the mailing list is a big help too. =head1 Installing BackupPC @@ -1532,8 +1538,9 @@ copy the pc directory using BackupPC_tarPCCopy: =head2 Fixing installation problems -Please see the FAQ at L for -debugging suggestions. +Please see the Wiki at L for +debugging suggestions. If you find a solution to your problem that +could help other users please add it to the Wiki! =head1 Restore functions @@ -2807,7 +2814,7 @@ new CSS skin for 3.0.0 with several layout improvements. Sean Cameron Youlin Feng provided the Chinese translation for 3.1.0. -Semper provided the Polish translation for 3.1.0. +Karol 'Semper' Stelmaczonek provided the Polish translation for 3.1.0. Jeremy Tietsort provided the host summary table sorting feature for 3.1.0. diff --git a/lib/BackupPC/Config/Meta.pm b/lib/BackupPC/Config/Meta.pm index 4833e54..a4f54c2 100644 --- a/lib/BackupPC/Config/Meta.pm +++ b/lib/BackupPC/Config/Meta.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.1.0beta0, released 3 Sep 2007. +# Version 3.1.0beta1, released 23 Sep 2007. # # See http://backuppc.sourceforge.net. # @@ -210,7 +210,7 @@ use vars qw(%ConfigMeta); SmbClientPath => {type => "execPath", undefIfEmpty => 1}, SmbClientFullCmd => "string", SmbClientIncrCmd => "string", - SmbClientRestoreCmd => "string", + SmbClientRestoreCmd => {type => "string", undefIfEmpty => 1}, TarShareName => { type => "list", @@ -219,7 +219,7 @@ use vars qw(%ConfigMeta); TarClientCmd => "string", TarFullArgs => "string", TarIncrArgs => "string", - TarClientRestoreCmd => "string", + TarClientRestoreCmd => {type => "string", undefIfEmpty => 1}, TarClientPath => {type => "string", undefIfEmpty => 1}, RsyncShareName => { @@ -237,14 +237,15 @@ use vars qw(%ConfigMeta); RsyncCsumCacheVerifyProb => "float", RsyncArgs => { - type => "list", - emptyOk => 1, - child => "string", + type => "list", + emptyOk => 1, + child => "string", }, RsyncRestoreArgs => { - type => "list", - emptyOk => 1, - child => "string", + type => "list", + emptyOk => 1, + undefIfEmpty => 1, + child => "string", }, BackupPCdCmd => "string", @@ -313,7 +314,7 @@ use vars qw(%ConfigMeta); CgiURL => "string", Language => { type => "select", - values => [qw(de en es fr it nl pt_br zh_CN)], + values => [qw(de en es fr it nl pl pt_br zh_CN)], }, CgiUserHomePageCheck => "string", CgiUserUrlCreate => "string", diff --git a/lib/BackupPC/Lib.pm b/lib/BackupPC/Lib.pm index 3a8cf18..011e394 100644 --- a/lib/BackupPC/Lib.pm +++ b/lib/BackupPC/Lib.pm @@ -72,7 +72,20 @@ require DynaLoader; BEGIN { eval "use IO::Dirent qw( readdirent DT_DIR );"; - $IODirentOk = 1 if ( !$@ ); + if ( !$@ && opendir(my $fh, ".") ) { + # + # Make sure the IO::Dirent really works - some installs + # on certain file systems don't return a valid type. + # + my $dt_dir = eval("DT_DIR"); + foreach my $e ( readdirent($fh) ) { + if ( $e->{name} eq "." && $e->{type} == $dt_dir ) { + $IODirentOk = 1; + last; + } + } + closedir($fh); + } }; # diff --git a/makeDist b/makeDist index 53c37e8..49bf9da 100755 --- a/makeDist +++ b/makeDist @@ -53,8 +53,8 @@ die("BackupPC::Lib->new failed\n") umask(0022); -my $Version = "3.1.0beta0"; -my $ReleaseDate = "3 Sep 2007"; +my $Version = "3.1.0beta1"; +my $ReleaseDate = "21 Oct 2007"; my $DistDir = "dist/BackupPC-$Version"; my @PerlSrc = qw( -- 2.20.1