Add support to ETCDIR, where real configuration files are installed on some distribution (BSD).

This commit is contained in:
Darold Gilles 2014-08-25 22:14:29 +02:00
parent c13bf6a642
commit 25e943aac3
1 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,7 @@ use ExtUtils::MakeMaker;
use strict; use strict;
my @ALLOWED_ARGS = ('LOGFILE','BINDIR','CONFDIR','HTMLDIR','BASEURL','DOCDIR','MANDIR','QUIET','INSTALLDIRS','DESTDIR'); my @ALLOWED_ARGS = ('LOGFILE','BINDIR','ETCDIR', 'CONFDIR','HTMLDIR','BASEURL','DOCDIR','MANDIR','QUIET','INSTALLDIRS','DESTDIR');
# Parse command line arguments and store them as environment variables # Parse command line arguments and store them as environment variables
while ($_ = shift) { while ($_ = shift) {
@ -24,6 +24,7 @@ if (! -d $default_log ) {
# Default install path # Default install path
my $LOGFILE = $ENV{LOGFILE} || $default_log; my $LOGFILE = $ENV{LOGFILE} || $default_log;
my $BINDIR = $ENV{BINDIR} || '/usr/local/bin'; my $BINDIR = $ENV{BINDIR} || '/usr/local/bin';
my $ETCDIR = $ENV{ETCDIR} || '/etc/squidanalyzer';
my $CONFDIR = $ENV{CONFDIR} || '/etc/squidanalyzer'; my $CONFDIR = $ENV{CONFDIR} || '/etc/squidanalyzer';
my $HTMLDIR = $ENV{HTMLDIR} || '/var/www/squidanalyzer'; my $HTMLDIR = $ENV{HTMLDIR} || '/var/www/squidanalyzer';
my $BASEURL = $ENV{BASEURL} || '/squidreport'; my $BASEURL = $ENV{BASEURL} || '/squidreport';
@ -127,7 +128,11 @@ close(INST);
`chmod 755 install_all.sh`; `chmod 755 install_all.sh`;
# Change path into the default configuration file # Change path into the default configuration file
`perl -p -i -e 's#/etc/squidanalyzer#$CONFDIR#' etc/squidanalyzer.conf squid-analyzer`; if ($ETCDIR ne '') {
`perl -p -i -e 's#/etc/squidanalyzer#$ETCDIR#' etc/squidanalyzer.conf squid-analyzer`;
} else {
`perl -p -i -e 's#/etc/squidanalyzer#$CONFDIR#' etc/squidanalyzer.conf squid-analyzer`;
}
`perl -p -i -e 's#^Output.*#Output $HTMLDIR#' etc/squidanalyzer.conf`; `perl -p -i -e 's#^Output.*#Output $HTMLDIR#' etc/squidanalyzer.conf`;
`perl -p -i -e 's#^LogFile.*#LogFile $LOGFILE#' etc/squidanalyzer.conf`; `perl -p -i -e 's#^LogFile.*#LogFile $LOGFILE#' etc/squidanalyzer.conf`;
`perl -p -i -e 's#^WebUrl.*#WebUrl $BASEURL#' etc/squidanalyzer.conf`; `perl -p -i -e 's#^WebUrl.*#WebUrl $BASEURL#' etc/squidanalyzer.conf`;