summaryrefslogtreecommitdiff
blob: bb51e4a3af0713d36f2ba300d6cfb214e7b1bb2c (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-proxy/squidguard/squidguard-1.2.0-r1.ebuild,v 1.3 2004/08/25 14:49:27 cyfred Exp $

inherit eutils

MY_P=squidGuard-${PV}
DESCRIPTION="Combined filter, redirector and access controller plugin for Squid."
HOMEPAGE="http://www.squidguard.org"
SRC_URI="http://ftp.teledanmark.no/pub/www/proxy/squidGuard/${MY_P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE=""

RDEPEND="www-proxy/squid
	>=sys-libs/db-2"
DEPEND="${RDEPEND}
	sys-devel/bison
	sys-devel/flex"

S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${A} || die "unpack problem"
	cd ${S}
	epatch ${FILESDIR}/${P}-db4.patch  || die
	epatch ${FILESDIR}/${P}-db41.patch || die
	epatch ${FILESDIR}/${P}-db42.patch || die

	autoconf || die "autoconf problem"
}

src_compile() {
	econf \
		--with-sg-config=/etc/squidGuard/squidGuard.conf \
		--with-sg-logdir=/var/log/squidGuard \
		|| die "configure problem"

	mv src/Makefile src/Makefile.orig
	sed <src/Makefile.orig >src/Makefile \
		-e "s|logdir\t= /var/log/squidGuard|logdir\t= ${D}/var/log/squidGuard|" \
		-e "s|cfgdir\t= /etc/squidGuard|cfgdir\t= ${D}/etc/squidGuard|"

	emake || die "compile problem"
}

src_install() {
	make prefix=${D}/usr install

	dodir /var/log/squidGuard
	fowners squid:squid /var/log/squidGuard

	insinto /etc/squidGuard/sample
	doins ${FILESDIR}/squidGuard.conf.*
	insinto /etc/squidGuard/sample/db
	doins ${FILESDIR}/blockedsites

	dodoc ANNOUNCE CHANGELOG COPYING GPL README
	dohtml doc/*.html
	docinto text
	dodoc doc/*.txt
}

pkg_postinst() {
	einfo "To use squidGuard, you should add the following line to your"
	einfo "/etc/squid/squid.conf:"
	einfo ""
	einfo "\tredirect_program /usr/bin/squidGuard"
	einfo ""
	einfo "Remember to edit /etc/squidGuard/squidGuard.conf first!"
	einfo "Examples can be found in /etc/squidGuard/sample/"
}