From 25e943aac3198309478326cfa4f829b4ef8de2bf Mon Sep 17 00:00:00 2001 From: Darold Gilles Date: Mon, 25 Aug 2014 22:14:29 +0200 Subject: [PATCH] Add support to ETCDIR, where real configuration files are installed on some distribution (BSD). --- Makefile.PL | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 595fb92..d9d88ec 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,7 +4,7 @@ use ExtUtils::MakeMaker; 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 while ($_ = shift) { @@ -24,6 +24,7 @@ if (! -d $default_log ) { # Default install path my $LOGFILE = $ENV{LOGFILE} || $default_log; my $BINDIR = $ENV{BINDIR} || '/usr/local/bin'; +my $ETCDIR = $ENV{ETCDIR} || '/etc/squidanalyzer'; my $CONFDIR = $ENV{CONFDIR} || '/etc/squidanalyzer'; my $HTMLDIR = $ENV{HTMLDIR} || '/var/www/squidanalyzer'; my $BASEURL = $ENV{BASEURL} || '/squidreport'; @@ -127,7 +128,11 @@ close(INST); `chmod 755 install_all.sh`; # 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#^LogFile.*#LogFile $LOGFILE#' etc/squidanalyzer.conf`; `perl -p -i -e 's#^WebUrl.*#WebUrl $BASEURL#' etc/squidanalyzer.conf`;