summaryrefslogtreecommitdiff
blob: cca5c424b6c499a89726cb8eea61dac2791d40ce (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=4

inherit eutils user

DESCRIPTION="A milter-based regular expression filter"
HOMEPAGE="http://www.benzedrine.cx/milter-regex.html"
SRC_URI="http://www.benzedrine.cx/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""

RDEPEND="|| ( mail-filter/libmilter mail-mta/sendmail )"
DEPEND="${RDEPEND}
	virtual/yacc"

src_prepare() {
	epatch "${FILESDIR}"/${P}-gentoo.patch
}

src_compile() {
	emake CC="$(tc-getCC)" -f Makefile.linux milter-regex
}

src_install() {
	dobin milter-regex

	keepdir /var/run/milter-regex

	insinto /etc/mail
	newins rules milter-regex.conf

	newconfd "${FILESDIR}"/milter-regex-conf milter-regex
	newinitd "${FILESDIR}"/milter-regex-init milter-regex

	doman *.8
}

pkg_preinst() {
	enewgroup milter
	# mail-milter/spamass-milter creates milter user with this home directory
	# For consistency reasons, milter user must be created here with this home directory
	# even though this package doesn't need a home directory for this user (#280571)
	enewuser milter -1 -1 /var/lib/milter milter

	fowners milter:milter /var/run/milter-regex
}

pkg_postinst() {
	elog "If you're using Sendmail, you'll need to add this to your sendmail.mc:"
	elog "  INPUT_MAIL_FILTER(\`milter-regex', \`S=unix:/var/run/milter-regex/milter-regex.sock, T=S:30s;R:2m')"
	echo
	elog "If you are using Postfix, you'll need to add this to your main.cf:"
	elog "  smtpd_milters     = unix:/var/run/milter-regex/milter-regex.sock"
	elog "  non_smtpd_milters = unix:/var/run/milter-regex/milter-regex.sock"
}