summaryrefslogtreecommitdiff
blob: 0d7bd1dccfb365207999812f275fdd7788042edd (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-proxy/dansguardian-dgav/dansguardian-dgav-6.4.2a.ebuild,v 1.1 2005/08/29 10:36:25 mrness Exp $

inherit eutils

DG_PN=${PN/-*/}
AV_PN=${PN/*-/}
DG_PV=2.8.0.6

DESCRIPTION="DansGuardian with Anti-Virus plugin"
HOMEPAGE="http://sourceforge.net/projects/dgav/"
SRC_URI="http://mirror.dansguardian.org/downloads/2/Stable/${DG_PN}-${DG_PV}.source.tar.gz
	mirror://gentoo/${DG_PN}-${DG_PV}-antivirus-${PV}-gentoo.patch.bz2"
#Replace SRC_URI with the following when upstream manage to generate a proper patch
#	mirror://sourceforge/${AV_PN}/${DG_PN}-${DG_PV}-antivirus-${PV}.patch.bz2

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~sparc ~ppc"
IUSE=""
DEPEND="!net-proxy/dansguardian
	virtual/libc
	net-libs/libesmtp
	app-antivirus/clamav"

S="${WORKDIR}/${DG_PN}-${DG_PV}"

src_unpack() {
	unpack ${A}

	cd ${S} || die "source dir not found"
	epatch ${FILESDIR}/dansguardian-xnaughty-2.7.6-1.diff
	epatch ../${DG_PN}-${DG_PV}-antivirus-${PV}-gentoo.patch

	#fix path to gentoo clamd socket
	sed -i -e "s:clamdsocket *= *'/tmp/clamd':clamdsocket = '/var/run/clamav/clamd.sock':" configure
}

src_compile() {
	./configure \
		--prefix= \
		--installprefix=${D} \
		--mandir=/usr/share/man/ \
		--cgidir=/var/www/localhost/cgi-bin/ \
		--with-av-engine=clamdscan \
		--runas_usr=clamav --runas_grp=clamav || die "./configure failed"
	emake OPTIMISE="${CFLAGS}" || die "emake failed"
}

src_install() {
	if [ -d "/etc/logrotate.d" ]; then
		dodir /etc/logrotate.d
	fi
	make install || die "make install failed"

	exeinto /etc/init.d
	newexe ${FILESDIR}/dansguardian.init dansguardian
	rm -rf ${D}/etc/rc.d
	sed -i -e 's/rc.d\///' ${D}/etc/dansguardian/logrotation #Fixing location of initscript

	dodoc INSTALL README* LICENSE

	#Create log directory
	diropts -m0700 -o clamav
	keepdir /var/log/dansguardian
}