summaryrefslogtreecommitdiff
blob: 884cfa76945ee8140491bec11e849774efc1d701 (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
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/amavis/amavis-0.2.1-r3.ebuild,v 1.4 2002/11/15 17:14:54 raker Exp $

S=${WORKDIR}/${P}
DESCRIPTION="Virus Scanner"
SRC_URI="http://www.amavis.org/dist/${P}.tar.gz"
HOMEPAGE="http://www.amavis.org/"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86 sparc sparc64"

DEPEND="net-mail/maildrop
	>=net-mail/tnef-0.13
	>=net-mail/vlnx-407e
	net-mail/qmail"

src_unpack() {
	unpack ${A}
	
	cd ${S}
	patch -p0 < ${FILESDIR}/${P}-securetar.patch
}

src_compile() {
	./reconf
	patch -p0 < ${FILESDIR}/${P}-gentoo.diff
	econf \
		--with-logdir=/var/log/scanmail \
		--with-virusdir=/var/tmp/virusmails \
		--enable-qmail || die

	make || die
}

src_install() {
	try make prefix=${D}/usr install
	into /usr
	dodoc AUTHORS BUGS COPYING ChangeLog FAQ HINTS NEWS README* TODO
	dodoc doc/amavis.txt
	dohtml -r doc
	dodir /var/log/scanmail
	dodir /var/tmp/virusmails
	chmod 1777 ${D}/var/log/scanmail
	chmod 1777 ${D}/var/tmp/virusmails
}

pkg_setup() {
	# from "createaccount" that was designed to run during the
	# installation phase

	error="no"
	whoami=`/usr/bin/id | cut -d'(' -f2 | cut -d')' -f1`

	aliases=/etc/mail/aliases

	if test "`echo \"virusalert\" | grep \"@\" | wc -l`" -eq 1; then
		echo "WARNING: using off-site mail account: \"virusalert\""
		echo "WARNING: be sure it is able to receive mail"
	else
		if test "`ls /home | grep -w \"virusalert\" | wc -l`" -eq 1; then
			true
		else
			if test -n "$aliases"; then
				if test "`grep \"virusalert\" $aliases | wc -l`" -lt 1; then
					if test -w "$aliases"; then
						echo "virusalert: $whoami" >> $aliases
					else
						echo "WARNING: $aliases is not writable by \"$whoami\""
						error="yes"
					fi
				fi
			else
				echo "WARNING: mail aliases file not found: /etc/aliases"
				error="yes"
			fi
		fi
	fi

	if test "$error" = "yes"; then
		einfo "WARNING: could not create mail account: \"virusalert\""
		einfo "WARNING: be sure to create it manually"
	fi
}