Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-filter/amavisd-new/
Date: Mon, 07 Sep 2020 20:05:37
Message-Id: 1599508790.49e5ef6551f5d4e11e684d7ab4c32e09dcaf0295.chewi@gentoo
1 commit: 49e5ef6551f5d4e11e684d7ab4c32e09dcaf0295
2 Author: Ralph Seichter <github <AT> seichter <DOT> de>
3 AuthorDate: Sun Sep 6 20:23:53 2020 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 7 19:59:50 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49e5ef65
7
8 mail-filter/amavisd-new: Depend on app-arch/arj
9
10 Depend on app-arch/arj instead of app-arch/unarj because of licensing.
11
12 Bug: https://bugs.gentoo.org/694746
13 Package-Manager: Portage-3.0.4, Repoman-3.0.1
14 Signed-off-by: Ralph Seichter <gentoo <AT> seichter.de>
15 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
16
17 .../amavisd-new/amavisd-new-2.12.0-r4.ebuild | 203 +++++++++++++++++++++
18 1 file changed, 203 insertions(+)
19
20 diff --git a/mail-filter/amavisd-new/amavisd-new-2.12.0-r4.ebuild b/mail-filter/amavisd-new/amavisd-new-2.12.0-r4.ebuild
21 new file mode 100644
22 index 00000000000..72dfb93265c
23 --- /dev/null
24 +++ b/mail-filter/amavisd-new/amavisd-new-2.12.0-r4.ebuild
25 @@ -0,0 +1,203 @@
26 +# Copyright 1999-2020 Gentoo Authors
27 +# Distributed under the terms of the GNU General Public License v2
28 +
29 +EAPI=7
30 +
31 +inherit systemd
32 +
33 +DESCRIPTION="High-performance interface between the MTA and content checkers"
34 +HOMEPAGE="https://gitlab.com/amavis/amavis"
35 +SRC_URI="https://gitlab.com/amavis/amavis/-/archive/v${PV}/amavis-v${PV}.tar.bz2"
36 +
37 +LICENSE="GPL-2 BSD-2"
38 +SLOT="0"
39 +KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
40 +IUSE="clamav courier dkim ldap mysql postgres qmail razor rspamd rspamd-https snmp spamassassin zmq"
41 +
42 +MY_RSPAMD_DEPEND="dev-perl/HTTP-Message
43 + dev-perl/JSON
44 + dev-perl/LWP-UserAgent-Determined"
45 +DEPEND="acct-user/amavis"
46 +RDEPEND="${DEPEND}
47 + app-arch/arc
48 + app-arch/bzip2
49 + app-arch/cabextract
50 + app-arch/cpio
51 + app-arch/gzip
52 + app-arch/lha
53 + app-arch/lrzip
54 + app-arch/lzop
55 + app-arch/ncompress
56 + app-arch/p7zip
57 + app-arch/pax
58 + app-arch/arj
59 + app-arch/unrar
60 + app-arch/xz-utils
61 + app-arch/zoo
62 + dev-lang/perl:*
63 + dev-perl/Archive-Zip
64 + dev-perl/BerkeleyDB
65 + dev-perl/Convert-BinHex
66 + dev-perl/File-LibMagic
67 + dev-perl/IO-Socket-SSL
68 + dev-perl/IO-stringy
69 + >=dev-perl/Mail-DKIM-0.31
70 + >=dev-perl/MailTools-1.58
71 + >=dev-perl/MIME-tools-5.415
72 + dev-perl/Net-LibIDN
73 + >=dev-perl/Net-Server-0.91
74 + dev-perl/Net-SSLeay
75 + dev-perl/Unix-Syslog
76 + net-mail/ripole
77 + net-mail/tnef
78 + >=sys-apps/coreutils-5.0-r3
79 + >=sys-libs/db-4.4.20
80 + virtual/mta
81 + virtual/perl-Compress-Raw-Zlib
82 + virtual/perl-Digest-MD5
83 + virtual/perl-File-Temp
84 + virtual/perl-IO-Compress
85 + virtual/perl-IO-Socket-IP
86 + virtual/perl-MIME-Base64
87 + virtual/perl-Time-HiRes
88 + clamav? ( app-antivirus/clamav )
89 + ldap? ( >=dev-perl/perl-ldap-0.33 )
90 + mysql? ( dev-perl/DBD-mysql )
91 + postgres? ( dev-perl/DBD-Pg )
92 + razor? ( mail-filter/razor )
93 + rspamd? ( ${MY_RSPAMD_DEPEND} )
94 + rspamd-https? ( ${MY_RSPAMD_DEPEND}
95 + dev-perl/LWP-Protocol-https
96 + dev-perl/Net-SSLeay )
97 + snmp? ( net-analyzer/net-snmp[perl] )
98 + spamassassin? ( mail-filter/spamassassin dev-perl/Image-Info )
99 + zmq? ( dev-perl/ZMQ-LibZMQ3 )"
100 +
101 +AMAVIS_ROOT="/var/lib/amavishome"
102 +S="${WORKDIR}/amavis-v${PV}"
103 +
104 +src_prepare() {
105 + if use courier ; then
106 + eapply -p0 amavisd-new-courier.patch
107 + fi
108 +
109 + if use qmail ; then
110 + eapply -p0 amavisd-new-qmqpqq.patch
111 + fi
112 +
113 + # We need to fix the daemon_user and daemon_group in amavis-mc even
114 + # though we're going to run it in the foreground, because it calls
115 + # "drop_priv" unconditionally and will crash if its user/group
116 + # doesn't exist.
117 + sed -i \
118 + -e '/daemon/s/vscan/amavis/' \
119 + -e "s:'/var/virusmails':\"\$MYHOME/quarantine\":" \
120 + "${S}/amavisd.conf" "${S}/amavis-mc" || die "missing conf file"
121 +
122 + if ! use dkim ; then
123 + sed -i -e '/enable_dkim/s/1/0/' "${S}/amavisd.conf" \
124 + || die "missing conf file - dkim"
125 + fi
126 +
127 + if use zmq ; then
128 + sed -i -e '/enable_zmq/s/# //' "${S}/amavisd.conf" \
129 + || die "missing conf file - zmq"
130 + fi
131 +
132 + if ! use spamassassin ; then
133 + sed -i -e \
134 + "/^#[[:space:]]*@bypass_spam_checks_maps[[:space:]]*=[[:space:]]*(1)/s/^#//" \
135 + "${S}/amavisd.conf" || die "missing conf file - sa"
136 + fi
137 +
138 + eapply_user
139 +}
140 +
141 +src_install() {
142 + dosbin amavisd{,-agent,-nanny,-release,-signer,-status}
143 + dobin p0f-analyzer.pl amavisd-submit
144 +
145 + if use snmp ; then
146 + dosbin amavisd-snmp-subagent
147 + newinitd "${FILESDIR}/amavisd-snmp-subagent.initd" \
148 + amavisd-snmp-subagent
149 + dodoc AMAVIS-MIB.txt
150 +
151 + if use zmq ; then
152 + dosbin amavisd-snmp-subagent-zmq
153 + newinitd "${FILESDIR}/amavisd-snmp-subagent-zmq.initd" \
154 + amavisd-snmp-subagent-zmq
155 + fi
156 + fi
157 +
158 + if use zmq ; then
159 + dosbin amavis-services amavis-mc
160 + newinitd "${FILESDIR}/amavis-mc.initd-r1" amavis-mc
161 + fi
162 +
163 + if use ldap ; then
164 + insinto /etc/openldap/schema
165 + newins LDAP.schema "${PN}.schema"
166 + fi
167 +
168 + # The config file should be root:amavis so that the amavis user can
169 + # read (only) it after dropping privileges. And of course he should
170 + # own everything in his home directory.
171 + insinto /etc
172 + insopts -m0640 -g amavis
173 + doins amavisd.conf
174 +
175 + # Implementation detail? Keepdir calls dodir under the hood.
176 + diropts -o amavis -g amavis
177 + keepdir "${AMAVIS_ROOT}"/{,db,quarantine,tmp,var}
178 +
179 + # BEWARE:
180 + #
181 + # Anything below this line is using the mangled insopts/diropts from
182 + # above!
183 + #
184 +
185 + newinitd "${FILESDIR}/amavisd.initd-r2" amavisd
186 +
187 + systemd_newunit "${FILESDIR}/amavisd.service-r1" amavisd.service
188 +
189 + dodoc AAAREADME.first INSTALL MANIFEST RELEASE_NOTES TODO \
190 + amavisd.conf-default amavisd-custom.conf
191 +
192 + docinto README_FILES
193 + dodoc README_FILES/README*
194 + dodoc -r README_FILES/*.{html,css}
195 + docinto README_FILES/images
196 + dodoc README_FILES/images/*.png
197 + docinto README_FILES/images/callouts
198 + dodoc README_FILES/images/callouts/*.png
199 +
200 + docinto test-messages
201 + dodoc test-messages/README
202 + dodoc test-messages/sample.tar.gz.compl
203 +}
204 +
205 +pkg_preinst() {
206 + # TODO: the following is done as root, but should probably be done
207 + # as the amavis user.
208 + if use razor ; then
209 + if [ ! -d "${ROOT}${AMAVIS_ROOT}/.razor" ] ; then
210 + elog "Setting up initial razor config files..."
211 +
212 + razor-admin -create -home="${D}/${AMAVIS_ROOT}/.razor"
213 + sed -i -e "s:debuglevel\([ ]*\)= .:debuglevel\1= 0:g" \
214 + "${D}/${AMAVIS_ROOT}/.razor/razor-agent.conf" || die
215 + fi
216 + fi
217 +}
218 +
219 +pkg_postinst() {
220 + local d="/var/amavis"
221 + if [ -d ${d} ]; then
222 + elog "Existing data found. Please make sure to manually copy it to amavis' new"
223 + elog "home directory by executing the following command as root from a shell:"
224 + elog
225 + elog " cp -a ${d}/* ${d}/.??* ${AMAVIS_ROOT}/ && rm -r ${d}"
226 + elog
227 + fi
228 +}