blob: 02aa8588561d685aec2f203423d66ec8039a8532 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-misc/squidalyser/squidalyser-0.2.55.ebuild,v 1.7 2005/05/25 15:33:55 mcummings Exp $
inherit eutils
IUSE=""
DESCRIPTION="Interactive log analyser for the Squid proxy."
HOMEPAGE="http://squidalyser.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
mirror://gentoo/${P}-gentoo.diff.bz2"
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86 ~sparc alpha ppc"
DEPEND="net-proxy/squid
dev-lang/perl
perl-core/CGI
dev-perl/DBI
dev-perl/DBD-mysql
dev-perl/Time-modules
perl-core/Time-HiRes
dev-perl/GD
dev-perl/GDGraph
dev-perl/GDTextUtil
dev-perl/URI
dev-db/mysql
net-www/apache"
src_unpack() {
unpack ${A}
cd ${S}
epatch ${WORKDIR}/${P}-gentoo.diff
}
src_install() {
# Create a user directory for squidalyser. Put the squidparse and sql scripts into it
dodir /usr/share/squidalyser/squidparse
cp ${S}/squidparse/squidparse.pl ${D}/usr/share/squidalyser/squidparse/squidparse.pl
dodir /etc/squidalyser
cp ${S}/squidparse/squidalyser.conf ${D}/etc/squidalyser/squidalyser.conf
dodir /usr/share/squidalyser/sql
cp ${S}/sql/* ${D}/usr/share/squidalyser/sql
dodir /usr/share/squidalyser/docs
cp ${S}/docs/* ${D}/usr/share/squidalyser/docs
# Put the apache scripts under the apache directory
chown apache ${S}/cgi-bin/*
chmod 755 ${S}/cgi-bin/*
dodir /home/httpd/cgi-bin
cp ${S}/cgi-bin/* ${D}/home/httpd/cgi-bin
dodir /home/httpd/icons
cp ${S}/icons/* ${D}/home/httpd/icons
}
pkg_preinst() {
ewarn "pkg_preinst()"
}
pkg_postinst() {
ewarn "pkg_postinst"
# start up mysql if it isn't already running
mysqlstat=`/etc/init.d/mysql status | grep -c started`
if [ ${mysqlstat} -lt 1 ]
then
/etc/init.d/mysql start
sleep 3
fi
# create the basic database
ewarn "configure mysql"
mysql --execute="drop database squid"
mysql --execute="create database squid"
mysql --execute="grant all privileges on squid.* to squidalyser@localhost identified by 'tr!red$';"
mysql squid < /usr/share/squidalyser/sql/squidalyser.sql
mysql squid --execute="delete from logfile"
ewarn "update crontab"
# Update the crontab for the squidparse routine
spcount=`grep -c squidparse.pl /etc/crontab`
if [ ${spcount} -gt 1 ]
then
ewarn "More than one entry in /etc/crontab. Please check."
elif [ ${spcount} -eq 1 ]
then
ewarn "squidparse.pl entry already in /etc/crontab, leaving alone"
else
echo "0 3 * * * root /usr/share/squidalyser/squidparse/squidparse.pl" >> /etc/crontab
fi
ewarn "Running squidparse for first time, this may take several minutes"
/usr/share/squidalyser/squidparse/squidparse.pl
}
|