Fix several issues with non default installation path. Thanks to Yuri Voinov for the report.
This commit is contained in:
parent
e98f8172bd
commit
a3859d1ae6
38
Makefile.PL
38
Makefile.PL
|
@ -24,8 +24,8 @@ 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} || '';
|
|
||||||
my $CONFDIR = $ENV{CONFDIR} || '/etc/squidanalyzer';
|
my $CONFDIR = $ENV{CONFDIR} || '/etc/squidanalyzer';
|
||||||
|
my $ETCDIR = $ENV{ETCDIR} || $CONFDIR;
|
||||||
my $HTMLDIR = $ENV{HTMLDIR} || '/var/www/squidanalyzer';
|
my $HTMLDIR = $ENV{HTMLDIR} || '/var/www/squidanalyzer';
|
||||||
my $BASEURL = $ENV{BASEURL} || '/squidreport';
|
my $BASEURL = $ENV{BASEURL} || '/squidreport';
|
||||||
my $DOCDIR = $ENV{DOCDIR} || '';
|
my $DOCDIR = $ENV{DOCDIR} || '';
|
||||||
|
@ -39,8 +39,8 @@ unless(open(INST, ">install_all.sh")) {
|
||||||
}
|
}
|
||||||
print INST qq{#!/bin/sh
|
print INST qq{#!/bin/sh
|
||||||
test ! -d "$DESTDIR$BINDIR" && mkdir -p $DESTDIR$BINDIR
|
test ! -d "$DESTDIR$BINDIR" && mkdir -p $DESTDIR$BINDIR
|
||||||
test ! -d "$DESTDIR$CONFDIR" && mkdir -p $DESTDIR$CONFDIR
|
test ! -d "$DESTDIR$ETCDIR" && mkdir -p $DESTDIR$ETCDIR
|
||||||
test ! -d "$DESTDIR$CONFDIR/lang" && mkdir -p $DESTDIR$CONFDIR/lang
|
test ! -d "$DESTDIR$ETCDIR/lang" && mkdir -p $DESTDIR$ETCDIR/lang
|
||||||
test ! -d "$DESTDIR$HTMLDIR" && mkdir -p $DESTDIR$HTMLDIR
|
test ! -d "$DESTDIR$HTMLDIR" && mkdir -p $DESTDIR$HTMLDIR
|
||||||
test ! -d "$DESTDIR$HTMLDIR/images" && mkdir -p $DESTDIR$HTMLDIR/images
|
test ! -d "$DESTDIR$HTMLDIR/images" && mkdir -p $DESTDIR$HTMLDIR/images
|
||||||
};
|
};
|
||||||
|
@ -52,14 +52,14 @@ test ! -d "$DESTDIR$DOCDIR" && mkdir -p $DESTDIR$DOCDIR
|
||||||
}
|
}
|
||||||
|
|
||||||
print INST qq{
|
print INST qq{
|
||||||
test ! -d "$DESTDIR$MANDIR" mkdir -p $DESTDIR$MANDIR
|
test ! -d "$DESTDIR$MANDIR" && mkdir -p $DESTDIR$MANDIR
|
||||||
|
|
||||||
# Copy files that must not be overriden
|
# Copy files that must not be overriden
|
||||||
for file in squidanalyzer.conf network-aliases user-aliases excluded included; do
|
for file in squidanalyzer.conf network-aliases user-aliases excluded included; do
|
||||||
if [ -r $DESTDIR$CONFDIR/\$file ]; then
|
if [ -r $DESTDIR$ETCDIR/\$file ]; then
|
||||||
install -m 644 etc/\$file $DESTDIR$CONFDIR/\$file.sample
|
install -m 644 etc/\$file $DESTDIR$ETCDIR/\$file.sample
|
||||||
else
|
else
|
||||||
install -m 644 etc/\$file $DESTDIR$CONFDIR/\$file
|
install -m 644 etc/\$file $DESTDIR$ETCDIR/\$file
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
install -m 755 squid-analyzer $DESTDIR$BINDIR/
|
install -m 755 squid-analyzer $DESTDIR$BINDIR/
|
||||||
|
@ -73,8 +73,9 @@ install -m 644 resources/images/back-arrow.png $DESTDIR$HTMLDIR/images/
|
||||||
install -m 644 resources/images/info.png $DESTDIR$HTMLDIR/images/
|
install -m 644 resources/images/info.png $DESTDIR$HTMLDIR/images/
|
||||||
install -m 644 resources/images/network.png $DESTDIR$HTMLDIR/images/
|
install -m 644 resources/images/network.png $DESTDIR$HTMLDIR/images/
|
||||||
install -m 644 resources/images/user.png $DESTDIR$HTMLDIR/images/
|
install -m 644 resources/images/user.png $DESTDIR$HTMLDIR/images/
|
||||||
install -m 644 lang/* $DESTDIR$CONFDIR/lang/
|
install -m 644 lang/* $DESTDIR$ETCDIR/lang/
|
||||||
pod2text doc/SquidAnalyzer.pod README
|
pod2text doc/SquidAnalyzer.pod README
|
||||||
|
pod2man doc/SquidAnalyzer.pod squid-analyzer.3
|
||||||
};
|
};
|
||||||
if ($DOCDIR ne '') {
|
if ($DOCDIR ne '') {
|
||||||
print INST qq{
|
print INST qq{
|
||||||
|
@ -83,6 +84,11 @@ if ($DOCDIR ne '') {
|
||||||
install -m 644 ChangeLog $DESTDIR$DOCDIR/
|
install -m 644 ChangeLog $DESTDIR$DOCDIR/
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if ($MANDIR ne '') {
|
||||||
|
print INST qq{
|
||||||
|
install -m 644 squid-analyzer.3 $DESTDIR$MANDIR/
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (!$ENV{QUIET}) {
|
if (!$ENV{QUIET}) {
|
||||||
print INST qq{
|
print INST qq{
|
||||||
|
@ -115,14 +121,16 @@ 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
|
||||||
if ($ETCDIR ne '') {
|
`perl -p -i -e 's#/.*/squidanalyzer.conf#$ETCDIR/squidanalyzer.conf#' etc/squidanalyzer.conf squid-analyzer`;
|
||||||
`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`;
|
||||||
|
`perl -p -i -e 's#^NetworkAlias.*#NetworkAlias $ETCDIR/network-aliases#' etc/squidanalyzer.conf`;
|
||||||
|
`perl -p -i -e 's#^UserAlias.*#UserAlias $ETCDIR/user-aliases#' etc/squidanalyzer.conf`;
|
||||||
|
`perl -p -i -e 's#^Exclude.*#Exclude $ETCDIR/excluded#' etc/squidanalyzer.conf`;
|
||||||
|
`perl -p -i -e 's#^Include.*#Include $ETCDIR/included#' etc/squidanalyzer.conf`;
|
||||||
|
`perl -p -i -e 's#Lang.*\.txt#Lang $ETCDIR/lang/en_US.txt#' etc/squidanalyzer.conf`;
|
||||||
|
|
||||||
my $zcat = `which zcat`;
|
my $zcat = `which zcat`;
|
||||||
chomp($zcat);
|
chomp($zcat);
|
||||||
`perl -p -i -e 's#^\\\$ZCAT_PROG.*#\\\$ZCAT_PROG = "$zcat";#' SquidAnalyzer.pm`;
|
`perl -p -i -e 's#^\\\$ZCAT_PROG.*#\\\$ZCAT_PROG = "$zcat";#' SquidAnalyzer.pm`;
|
||||||
|
@ -142,10 +150,10 @@ WriteMakefile(
|
||||||
'AUTHOR' => 'Gilles Darold (gilles@darold.net)',
|
'AUTHOR' => 'Gilles Darold (gilles@darold.net)',
|
||||||
'ABSTRACT' => 'Squid log analyzer',
|
'ABSTRACT' => 'Squid log analyzer',
|
||||||
'EXE_FILES' => [ qw(squid-analyzer) ],
|
'EXE_FILES' => [ qw(squid-analyzer) ],
|
||||||
'MAN3PODS' => { 'doc/SquidAnalyzer.pod' => 'blib/man3/squidanalyzer.3' },
|
'MAN3PODS' => { 'doc/SquidAnalyzer.pod' => 'blib/man3/SquidAnalyzer.3' },
|
||||||
'DESTDIR' => $ENV{DESTDIR},
|
'DESTDIR' => $ENV{DESTDIR},
|
||||||
'INSTALLDIRS' => $ENV{INSTALLDIRS},
|
'INSTALLDIRS' => $ENV{INSTALLDIRS},
|
||||||
'clean' => { FILES => "install_all.sh lib/blib/" },
|
'clean' => { FILES => "install_all.sh lib/blib/ squid-analyzer.3" },
|
||||||
'META_MERGE' => {
|
'META_MERGE' => {
|
||||||
resources => {
|
resources => {
|
||||||
homepage => 'http://squidanalyzer.darold.net/',
|
homepage => 'http://squidanalyzer.darold.net/',
|
||||||
|
|
Loading…
Reference in New Issue