- Large set of changes for config editing, rsync hardlinks etc
[BackupPC.git] / makeDist
index e31e844..f53d984 100755 (executable)
--- a/makeDist
+++ b/makeDist
@@ -16,7 +16,7 @@
 #   Craig Barratt <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2001-2003  Craig Barratt
+#   Copyright (C) 2001-2004  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
@@ -42,8 +42,8 @@ use Getopt::Std;
 
 umask(0022);
 
-my $Version     = "2.1.0_CVS";
-my $ReleaseDate = "8 Feb 2004";
+my $Version     = "2.2.0alpha";
+my $ReleaseDate = "15 Aug 2004";
 my $DistDir     = "dist/BackupPC-$Version";
 
 my @PerlSrc = qw(
@@ -63,15 +63,18 @@ my @PerlSrc = qw(
     bin/BackupPC_zipCreate
     bin/BackupPC_zcat
     lib/BackupPC/Attrib.pm
+    lib/BackupPC/Config.pm
     lib/BackupPC/FileZIO.pm
     lib/BackupPC/Lib.pm
     lib/BackupPC/PoolWrite.pm
+    lib/BackupPC/Storage.pm
     lib/BackupPC/View.pm
     lib/BackupPC/CGI/AdminOptions.pm
     lib/BackupPC/CGI/Archive.pm
     lib/BackupPC/CGI/ArchiveInfo.pm
     lib/BackupPC/CGI/Browse.pm
     lib/BackupPC/CGI/DirHistory.pm
+    lib/BackupPC/CGI/EditConfig.pm
     lib/BackupPC/CGI/EmailSummary.pm
     lib/BackupPC/CGI/GeneralInfo.pm
     lib/BackupPC/CGI/HostInfo.pm
@@ -87,14 +90,20 @@ my @PerlSrc = qw(
     lib/BackupPC/CGI/StopServer.pm
     lib/BackupPC/CGI/Summary.pm
     lib/BackupPC/CGI/View.pm
+    lib/BackupPC/Config/Meta.pm
     lib/BackupPC/Lang/de.pm
     lib/BackupPC/Lang/en.pm
     lib/BackupPC/Lang/es.pm
     lib/BackupPC/Lang/fr.pm
+    lib/BackupPC/Lang/it.pm
+    lib/BackupPC/Lang/nl.pm
+    lib/BackupPC/Lang/pt_br.pm
+    lib/BackupPC/Storage/Text.pm
     lib/BackupPC/Xfer/Archive.pm
     lib/BackupPC/Xfer/Smb.pm
     lib/BackupPC/Xfer/Tar.pm
     lib/BackupPC/Xfer/Rsync.pm
+    lib/BackupPC/Xfer/RsyncDigest.pm
     lib/BackupPC/Xfer/RsyncFileIO.pm
     lib/BackupPC/Zip/FileMember.pm
     cgi-bin/BackupPC_Admin
@@ -113,10 +122,26 @@ my $ConfVars = {};
 my $errCnt;
 
 $errCnt += CheckConfigParams("conf/config.pl", $ConfVars, 0);
+
+$errCnt += CheckConfigParams("doc-src/BackupPC.pod", $ConfVars, 1);
+
+#
+# These config parameters are not used in the code, so ignore them.
+#
 $ConfVars->{BackupPCUser} = 2;
-$ConfVars->{CgiDir} = 2;
-$ConfVars->{InstallDir} = 2;
-$ConfVars->{CgiImageDir} = 2;
+$ConfVars->{CgiDir}       = 2;
+$ConfVars->{InstallDir}   = 2;
+$ConfVars->{CgiImageDir}  = 2;
+
+#
+# These config parameters are used in the code to be backward compatible,
+# but are not present in the current config file, so ignore them.
+#
+$ConfVars->{BlackoutHourBegin} = 2;
+$ConfVars->{BlackoutHourEnd}   = 2;
+$ConfVars->{BlackoutWeekDays}  = 2;
+$ConfVars->{RsyncLogLevel}     = 2;
+
 foreach my $file ( @PerlSrc ) {
     $errCnt += CheckConfigParams($file, $ConfVars, 1);
 }
@@ -145,7 +170,9 @@ mkpath($DistDir, 0, 0777);
 
 foreach my $dir ( qw(bin doc conf images init.d/src cgi-bin
                     lib/BackupPC/CGI
+                    lib/BackupPC/Config
                     lib/BackupPC/Lang
+                    lib/BackupPC/Storage
                     lib/BackupPC/Xfer
                     lib/BackupPC/Zip
                ) ) {
@@ -170,11 +197,13 @@ foreach my $file ( (@PerlSrc,
            qw(
                conf/config.pl
                conf/hosts
+               conf/BackupPC_stnd.css
                init.d/README
                init.d/src/debian-backuppc
                init.d/src/gentoo-backuppc
                init.d/src/gentoo-backuppc.conf
                init.d/src/linux-backuppc
+               init.d/src/slackware-backuppc
                init.d/src/solaris-backuppc
                init.d/src/suse-backuppc
                doc/BackupPC.pod
@@ -191,6 +220,8 @@ system("cd dist ; tar zcf BackupPC-$Version.tar.gz BackupPC-$Version");
 print("Distribution written to dist/BackupPC-$Version.tar.gz\n");
 unlink("pod2htmd.x~~");
 unlink("pod2htmi.x~~");
+unlink("pod2htmd.tmp");
+unlink("pod2htmi.tmp");
 
 ###########################################################################
 # Subroutines
@@ -209,14 +240,30 @@ sub InstallFile
        binmode(FILE);
        binmode(OUT);
        while ( <FILE> ) {
-           s/^# *Version \d+\.\d+[\.\w]*, released \d+ \w+ \d{4}\.?/# Version __VERSION__, released __RELEASEDATE__./;
+           s/^([#*\s]+)Version \d+\.\d+[\.\w]*, released \d+ \w+ \d{4}\.?/$1Version __VERSION__, released __RELEASEDATE__./;
            s/__VERSION__/$Version/g;
            s/__RELEASEDATE__/$ReleaseDate/g;
-           if ( $file =~ /BackupPC\.html$/ && !/A NAME="item_%24Conf/ ) {
-               s/\$Conf{([^}]*)}/
+           if ( $file =~ /BackupPC\.html$/ ) {
+               #
+               # fixup for perl 5.6.x
+               #
+               if ( !/A NAME="item_(%|_)24Conf/i ) {
+                   s/\$Conf{([^}]*)}/
                        defined($ConfName{$1})
-                           ? "<A HREF=\"#$ConfName{$1}\">\$Conf{$1}<\/A>"
+                           ? "\L<A HREF=\"#$ConfName{$1}\">\E\$Conf{$1}<\/A>"
                            : "\$Conf{$1}"/eg;
+               }
+               s/<(A NAME="item_(%|_)24Conf(%|_)7B(.*?)(%|_)7D).*?">/\L<A NAME="item_%24Conf%7b$4%7d">/ig;
+               s/^<DD>/<DD><P>/;
+               #
+               # Fixup for perl 5.8.x first one no longer needed after
+               # fix in CSS)
+               #
+#              if ( /^<\/dt>/ ) {
+#                  $_ .= <FILE>;
+#                  s/^(<\/dt>\n<dd>)/$1<p>/s;
+#              }
+               s/^<li><\/li>/<li>/;
            }
            if ( /__CONFIGPOD__/ ) {
                print OUT $ConfPod;
@@ -280,7 +327,7 @@ sub config2pod
                 s/([^;])\s*$/$1 .../;
             }
             push(@conf, $_);
-            my $text = $_;
+            my $text = "\$Conf{$var}";
             $text =~ s/\s+/_/sg;
             $text =~ s{(\W)}{sprintf("%%%02X", ord($1) )}gxe;
             $text = substr($text, 0, 50);
@@ -325,7 +372,7 @@ sub CheckConfigParams
                 } else {
                     $vars->{$1}++;
                 }/eg;
-            s/UserCommandRun\("([^"]*)"\)/if ( !defined($vars->{$1}) ) {
+            s/UserCommandRun\("([^"]*)"/if ( !defined($vars->{$1}) ) {
                     print("Unexpected Conf var $1 in $file\n");
                     $errors++;
                 } else {
@@ -359,6 +406,7 @@ sub CheckLangUsage
        open(F, $file) || die("can't open $file");
        binmode(F);
        while ( <F> ) {
+           next if ( /^\s*#/ );
            s/\$Lang->{([^}]*)}/$vars->{$1} = 1;/eg;
        }
        close(F);
@@ -373,6 +421,7 @@ sub CheckLangUsage
             s/\$Lang{([^}]*)}/
                    my $var = $1;
                    next if ( $var =~ m{^(Reason_|Status_|backupType_)} );
+                   next if ( $var eq "Documentation" );
                     if ( !defined($vars->{$var}) ) {
                         print("Unexpected Lang var $var in $f\n");
                         $errors++;
@@ -404,7 +453,7 @@ sub CheckLangTags
     my($en, $enVars) = LangParse("lib/BackupPC/Lang/en.pm");
     my($errors);
 
-    foreach my $lang ( qw(fr.pm de.pm es.pm) ) {
+    foreach my $lang ( qw(fr.pm de.pm es.pm it.pm nl.pm) ) {
        my($d, $dVars) = LangParse("lib/BackupPC/Lang/$lang");
        foreach my $v1 ( @$en ) {
            my $v2 = shift(@$d);