summaryrefslogtreecommitdiff
blob: 4c7123b4fe15ee29b805404cf94c757bb59e31c7 (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
# Copyright 1999-2004 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.9 2004/02/28 11:11:58 weeve Exp $

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

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

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

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

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

src_install() {
	make prefix=${D}/usr install || die
	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
}