~ubuntu-branches/ubuntu/oneiric/awstats/oneiric

« back to all changes in this revision

Viewing changes to tools/awstats_configure.pl

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard, Sergey B Kirpichev, Jonas Smedegaard
  • Date: 2009-03-03 18:19:24 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090303181924-szfwaw0qmfdg7m6b
Tags: 6.9~dfsg-1
[ Sergey B Kirpichev ]
* New upstream release (Closes: #494676).
* Add myself to Uploaders field. 
* Drop patches 0001 and 1005 (applied upstream).
* Unfuzz patches 1002-1004.
* Add new patch 1007 updating Russian translation. Thanks to Sergey
  Kirpichev at upstream tracker #2540486.
* Add new patch 1008 enhancing the ExtraSection headings to include
  the words (Top XXX) for consistency with all other section headings.
* Add new patch 1009 fixing URL to Hurd (Closes: #408086).
* Add new patch 1010 fixing dirdata permissions (Closes: #299148).
* Add new patch 1011 fixing Geo::IPfree warnings (Closes: #512373).
* Add new patch 2001 hiding charts in days of month statistics.
* Use debian defaults for geoip data files.

[ Jonas Smedegaard ]
* Repackage upstream tarball.
* Packaging moved to Git (from Subversion). Update debian/control and
  git-buildpackage configfile, enabling pristine-tar support.
* Use new local CDBS snippet package-relations.mk to resolve, cleanup
  and apply CDBS-declared (build-)dependencies.
* Add DEB_MAINTAINER_MODE in debian/rules (thanks to Romain Beauxis).
* Update local CDBS snippets:
  + upstream-tarball.mk: internal restructuring
  + buildinfo.mk: fix copyright years
  + copyright-check.mk: major rewrite, now generating hint file more
    readily usable as template for new proposed copyright format
  + Update README.cdbs-tweaks to also cover newly added package-
    relations.mk.
* Rewrite debian/copyright using new proposed syntax (v440). Update
  copyright-hints.
* Unfuzz patch 1006.
* Depend on misc:depends (thanks to lintian) and cdbs:depends
  (currently unused, and drop superfluous dependencies (fulfilled by
  perl even in oldstable).

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
# - Create AWStats config file
9
9
# See COPYING.TXT file about AWStats GNU General Public License.
10
10
#-------------------------------------------------------
11
 
# $Revision: 1.7 $ - $Author: eldy $ - $Date: 2007/04/02 18:30:51 $
 
11
# $Revision: 1.8 $ - $Author: eldy $ - $Date: 2008/04/06 13:45:23 $
12
12
require 5.005;
13
13
 
14
14
use strict;
46
46
eval('use Win32::TieRegistry ( Delimiter=>"/", TiedRef=>\$reg )');
47
47
 
48
48
use vars qw/ $REVISION $VERSION /;
49
 
$REVISION='$Revision: 1.7 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
 
49
$REVISION='$Revision: 1.8 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
50
50
$VERSION="1.0 (build $REVISION)";
51
51
 
52
52
use vars qw/
132
132
                $_ =~ s/\s#.*$//;
133
133
        
134
134
                # Change line
135
 
                if ($_ =~ /^CustomLog\s(.*)\scommon$/i) { $savline="CustomLog $1 combined"; }
 
135
                if ($_ =~ /^(\s*)CustomLog\s(.*)\scommon$/i)    { $savline="$1CustomLog $2 combined"; }
136
136
                
137
137
                # Write line
138
138
                print FILETMP "$savline";       
460
460
        my $awstatsiconsfound=0;
461
461
        my $awstatscgifound=0;
462
462
        my $awstatsdirectoryfound=0;
463
 
        while(<CONF>) {
464
 
                if ($_ =~ /^CustomLog\s(.*)\scommon$/i) {
 
463
        while(<CONF>)
 
464
        {
 
465
                if ($_ =~ /^\s*CustomLog\s(.*)\scommon$/i)
 
466
                {
465
467
                        print "Warning: You Apache config file contains directives to write 'common' log files\n";
466
468
                        print "This means that some features can't work (os, browsers and keywords detection).\n";
467
469
                        print "Do you want me to setup Apache to write 'combined' log files [y/N] ? ";
475
477
                                goto READ;
476
478
                        }
477
479
                }
478
 
                if ($_ =~ /^CustomLog\s(.*)\scombined$/i)       { $LogFormat{$key}=1; }
 
480
                if ($_ =~ /^\s*CustomLog\s(.*)\scombined$/i)    { $LogFormat{$key}=1; }
479
481
                if ($_ =~ /Alias \/awstatsclasses/)             { $awstatsclassesfound=1; }
480
482
                if ($_ =~ /Alias \/awstatscss/)                         { $awstatscssfound=1; }
481
483
                if ($_ =~ /Alias \/awstatsicons/)                       { $awstatsiconsfound=1; }
485
487
    }   
486
488
        close CONF;
487
489
 
488
 
        if ($awstatsclassesfound && $awstatscssfound && $awstatsiconsfound && $awstatscgifound && $awstatsdirectoryfound) {
 
490
        if ($awstatsclassesfound && $awstatscssfound && $awstatsiconsfound && $awstatscgifound && $awstatsdirectoryfound)
 
491
        {
489
492
                $UseAlias=1;
490
493
                if ($commonchangedtocombined) { print "  Common log files changed to combined.\n"; }
491
 
                print "  AWStats directives already present.\n";
 
494
                print "  All AWStats directives are already present.\n";
492
495
                next;
493
 
        } elsif (!$commonchangedtocombined) {
494
 
        next;
495
 
    }
 
496
        }
496
497
 
497
498
        # Add awstats directives
498
499
        open(CONF,">>$key") || error("Failed to open config file '$key' for adding AWStats directives");
499
 
                binmode CONF;
500
 
                if (! $awstatsclassesfound || ! $awstatscssfound || ! $awstatsiconsfound || ! $awstatscgifound) {
501
 
                        print CONF "$CR\n";
502
 
                        print CONF "#$CR\n";
503
 
                        print CONF "# Directives to allow use of AWStats as a CGI$CR\n";
504
 
                        print CONF "#$CR\n";
505
 
                }
506
 
                if (! $awstatsclassesfound) {
507
 
                        print "  Add 'Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"'\n";
508
 
                        print CONF "Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"$CR\n";
509
 
                }
510
 
                if (! $awstatscssfound) {
511
 
                        print "  Add 'Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"'\n";
512
 
                        print CONF "Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"$CR\n";
513
 
                }
514
 
                if (! $awstatsiconsfound) {
515
 
                        print "  Add 'Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"'\n";
516
 
                        print CONF "Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"$CR\n";
517
 
                }
518
 
                if (! $awstatscgifound) {
519
 
                        print "  Add 'ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"'\n";
520
 
                        print CONF "ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"$CR\n";
521
 
                }
522
 
                if (! $awstatsdirectoryfound) {
523
 
                        print "  Add '<Directory>' directive\n";
524
 
                        print CONF "$CR\n";
 
500
        binmode CONF;
 
501
        if (! $awstatsclassesfound || ! $awstatscssfound || ! $awstatsiconsfound || ! $awstatscgifound) {
 
502
                print CONF "$CR\n";
 
503
                print CONF "#$CR\n";
 
504
                print CONF "# Directives to allow use of AWStats as a CGI$CR\n";
 
505
                print CONF "#$CR\n";
 
506
        }
 
507
        if (! $awstatsclassesfound) {
 
508
                print "  Add 'Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"'\n";
 
509
                print CONF "Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"$CR\n";
 
510
        }
 
511
        if (! $awstatscssfound) {
 
512
                print "  Add 'Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"'\n";
 
513
                print CONF "Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"$CR\n";
 
514
        }
 
515
        if (! $awstatsiconsfound) {
 
516
                print "  Add 'Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"'\n";
 
517
                print CONF "Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"$CR\n";
 
518
        }
 
519
        if (! $awstatscgifound) {
 
520
                print "  Add 'ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"'\n";
 
521
                print CONF "ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"$CR\n";
 
522
        }
 
523
        if (! $awstatsdirectoryfound) {
 
524
                print "  Add '<Directory>' directive\n";
 
525
                print CONF "$CR\n";
525
526
print CONF <<EOF;
526
527
#
527
528
# This is to permit URL access to scripts/files in AWStats directory.
534
535
</Directory>
535
536
 
536
537
EOF
537
 
                }
 
538
        }
538
539
        close CONF;
539
540
        $UseAlias=1;
540
541
        $WebServerChanged=1;