# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils DESCRIPTION="milter-regex allows you to filter mail using regular expressions" HOMEPAGE="http://www.benzedrine.cx/milter-regex.html" SRC_URI="http://www.benzedrine.cx/${P}.tar.gz" LICENSE="BSD" SLOT="0" KEYWORDS="~x86" IUSE="milter" DEPEND=">=sys-devel/bison-2.3 || ( mail-filter/libmilter mail-mta/sendmail )" src_unpack() { unpack ${A} cd ${S} || die "could not cd to ${S}" # make parse.y work with bison epatch ${FILESDIR}/Makefile.linux-${PV}.patch epatch ${FILESDIR}/parse.y-${PV}.patch # fix a typo in upstream sample rules epatch ${FILESDIR}/rules-${PV}.patch } src_compile() { cd ${S} || die "could not cd to ${S}" emake -f Makefile.linux milter-regex || die "milter-regex emake failed" } src_install() { # this helps us not have to hard-code config variables source ${FILESDIR}/milter-regex-conf cd ${S} || die "could not cd to ${S}" exeinto /usr/bin doexe milter-regex insinto ${CONFIG%/*} newins rules ${CONFIG##*/}.sample keepdir ${SOCKET%/*} newconfd ${FILESDIR}/milter-regex-conf milter-regex newinitd ${FILESDIR}/milter-regex-init milter-regex doman *.8 ewarn ewarn "Sample rules file installed at ${CONFIG}.sample" ewarn ewarn "If you're using Sendmail, you'll need to add this to your sendmail.mc:" ewarn " INPUT_MAIL_FILTER(\`milter-regex', \`S=unix:${SOCKET}, T=S:30s;R:2m')" ewarn ewarn "If you are using Postfix, you'll need to add this to your main.cf:" ewarn " smtpd_milters = unix:${SOCKET}" ewarn " non_smtpd_milters = unix:${SOCKET}" ewarn } pkg_postinst() { # this helps us not have to hard-code config variables source /etc/conf.d/milter-regex # this is the same user as sid-milter and others enewgroup ${USER} enewuser ${USER} -1 -1 -1 ${USER} if [[ ! -e ${CONFIG} ]]; then ewarn "You don't have anything at ${CONFIG}." ewarn "Copying ${CONFIG##*/}.sample to ${CONFIG} to get you started." cp -vp ${CONFIG}.sample ${CONFIG}; fi chown ${USER} ${SOCKET%/*} }