/[gentoo-x86]/mail-filter/MailScanner/MailScanner-4.84.5.2.ebuild
Gentoo

Contents of /mail-filter/MailScanner/MailScanner-4.84.5.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Oct 11 07:00:02 2012 UTC (23 months, 2 weeks ago) by patrick
Branch: MAIN
Re-import of MailScanner, see erroneous removal #251575

(Portage version: 2.2.0_alpha137/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/mail-filter/MailScanner/Attic/MailScanner-4.79.11.1.ebuild,v 1.2 2010/07/05 09:19:46 scarabeus dead $
4
5 inherit eutils versionator multilib
6
7 MY_PV=$(get_version_component_range 1-3 )
8 MY_PVR=$(replace_version_separator 3 '-' )
9
10 DESCRIPTION="Free Anti-Virus and Anti-Spam Filter"
11 HOMEPAGE="http://www.mailscanner.info/"
12 SRC_URI="http://www.mailscanner.info/files/4/tar/${PN}-install-${MY_PVR}.tar.gz"
13
14 LICENSE="GPL-2"
15 SLOT="0"
16 KEYWORDS="~amd64 ~x86"
17 IUSE="clamav doc exim postfix spamassassin"
18
19 DEPEND="dev-lang/perl"
20 RDEPEND="${DEPEND}
21 dev-perl/Archive-Zip
22 virtual/perl-IO-Compress
23 dev-perl/Convert-BinHex
24 dev-perl/Convert-TNEF
25 dev-perl/DBD-SQLite
26 dev-perl/DBI
27 dev-perl/Filesys-Df
28 dev-perl/HTML-Parser
29 dev-perl/HTML-Tagset
30 dev-perl/IO-stringy
31 dev-perl/MIME-tools
32 dev-perl/MailTools
33 dev-perl/Net-CIDR
34 dev-perl/Net-DNS
35 dev-perl/OLE-StorageLite
36 dev-perl/Sys-Hostname-Long
37 dev-perl/TimeDate
38 net-mail/tnef
39 dev-perl/Sys-SigAction
40 virtual/perl-File-Spec
41 virtual/perl-File-Temp
42 virtual/perl-Getopt-Long
43 virtual/perl-Sys-Syslog
44 virtual/perl-MIME-Base64
45 postfix? ( mail-mta/postfix )
46 exim? ( !postfix? ( mail-mta/exim ) )
47 !postfix? ( !exim? ( mail-mta/sendmail ) )
48 clamav? ( app-antivirus/clamav )
49 spamassassin? ( mail-filter/spamassassin )"
50
51 S="${WORKDIR}/${PN}-${MY_PVR}"
52 BASE="/usr"
53
54 src_unpack() {
55 unpack ${A}
56 unpack ./${PN}-install-${MY_PV}/perl-tar/${PN}-${MY_PVR}.tar.gz
57
58 # setup MTA
59 if use postfix ; then
60 RUNASUSER='postfix'
61 RUNASGROUP='postfix'
62 INQUEUE='/var/spool/postfix.in/deferred'
63 OUTQUEUE='/var/spool/postfix/incoming'
64 MTA='postfix'
65 SENDMAIL='/usr/lib/sendmail'
66 SENDMAIL2='/usr/lib/sendmail'
67 elif use exim ; then
68 RUNASUSER='mail'
69 RUNASGROUP='mail'
70 INQUEUE='/var/spool/exim.in/input'
71 OUTQUEUE='/var/spool/exim/input'
72 MTA='exim'
73 SENDMAIL='/usr/sbin/exim -oMr MailScanner'
74 SENDMAIL2='/usr/sbin/exim -C /etc/exim/exim_out.conf -oMr MailScanner'
75 else
76 # use sendmail as default, but we should add more as needed
77 # RUNASUSER='mail'
78 # RUNASGROUP='mail'
79 INQUEUE='/var/spool/mqueue.in'
80 OUTQUEUE='/var/spool/mqueue'
81 MTA='sendmail'
82 SENDMAIL='/usr/lib/sendmail'
83 SENDMAIL2='/usr/lib/sendmail'
84 fi
85
86 # setup virus scanner(s)
87 VIRUS_SCANNERS=""
88 use clamav && VIRUS_SCANNERS="clamav ${VIRUS_SCANNERS}"
89
90 if [ "$VIRUS_SCANNERS" == "" ]; then
91 VIRUS_SCANNERS="none"
92 VIRUS_SCANNING="no"
93 else
94 VIRUS_SCANNING="yes"
95 fi
96
97 sed -i \
98 -e "s/^\(Virus Scanning[ \t]*=\).*/\1 ${VIRUS_SCANNING}/" \
99 -e "s/^\(Virus Scanners[ \t]*=\).*/\1 ${VIRUS_SCANNERS}/" \
100 "${S}/etc/MailScanner.conf"
101
102 # setup spamassassin
103 if use spamassassin ; then
104 sed -i \
105 -e "s/^\(Use SpamAssassin[ \t]*=\).*$/\1 yes/" \
106 "${S}/etc/MailScanner.conf"
107 else
108 sed -i \
109 -e "s/^\(Use SpamAssassin[ \t]*=\).*$/\1 no/" \
110 "${S}/etc/MailScanner.conf"
111 fi
112
113 # update bin files
114 sed -i \
115 -e "s#msbindir=/opt/MailScanner/bin#msbindir=/usr/sbin#g" \
116 -e "s#config=/opt/MailScanner/etc/MailScanner.conf#config=/etc/MailScanner/MailScanner.conf#g" \
117 "${S}/bin/check_mailscanner"
118 for each in update_virus_scanners update_phishing_sites update_bad_phishing_sites ; do
119 sed -i \
120 -e "s#/opt/MailScanner/etc#/etc/MailScanner#g" \
121 "${S}"/bin/${each}
122 done
123 sed -i \
124 -e "s#/etc/sysconfig/MailScanner#/etc/conf.d/MailScanner#g" \
125 "${S}"/bin/update_spamassassin
126 sed -i \
127 -e "s#/opt/MailScanner/etc#/etc/MailScanner#g" \
128 -e "s#/opt/MailScanner/lib#/usr/lib/MailScanner#g" \
129 "${S}"/bin/MailScanner
130
131 # update cron files
132 sed -i \
133 -e "s#/opt/MailScanner/bin/check_mailscanner#/usr/sbin/check_MailScanner#g" \
134 "${S}"/bin/cron/check_MailScanner.cron
135 for cronfile in update_virus_scanners.cron update_{,bad_}phishing_sites.cron; do
136 sed -i \
137 -e "s#/etc/sysconfig/MailScanner#/etc/conf.d/mailscanner#g" \
138 -e "s#/opt/MailScanner/bin#/usr/sbin#g" \
139 "${S}"/bin/cron/${cronfile}
140 done
141
142 # Determine some things that may need to be changed in conf file
143 # (need to arrive at sensible replacement for yoursite)
144 YOURSITE=`dnsdomainname | sed -e "s/\./-/g"`
145 BASEBIN="${BASE}/sbin"
146
147 # ClamAV requires some specific changes to MailScanner.conf
148 # when mailscanner is running as root (i.e. sendmail)
149 if use clamav ; then
150 if [ "$MTA" == "sendmail" ] ; then
151 WORKGRP="clamav"
152 WORKPERM="0640"
153 else
154 WORKGRP=""
155 WORKPERM="0600"
156 fi
157 else
158 WORKGRP=""
159 WORKPERM="0600"
160 fi
161
162 # update conf files
163 sed -i \
164 -e "s#/opt/MailScanner/etc#/etc/MailScanner#g" \
165 -e "s#/opt/MailScanner/bin#$BASEBIN#g" \
166 -e "s#/opt/MailScanner/lib#/usr/lib/MailScanner#g" \
167 -e "s#^\(Run As User[ \t]*=\).*#\1 $RUNASUSER#" \
168 -e "s#^\(Run As Group[ \t]*=\).*#\1 $RUNASGROUP#" \
169 -e "s#^\(Incoming Queue Dir[ \t]*=\).*#\1 $INQUEUE#" \
170 -e "s#^\(Outgoing Queue Dir[ \t]*=\).*#\1 $OUTQUEUE#" \
171 -e "s#^\(MTA[ \t]*=\).*#\1 $MTA#" \
172 -e "s/^#\(TNEF.*internal\)$/\1/" \
173 -e "s/^\(TNEF.*0000\)$/#\1/" \
174 -e "s#^\(PID file[ \t]=\).*#\1 /var/run/mailscanner.pid#" \
175 -e "s#^\(%org-name%\)[ \t]*=.*#\1 = ${YOURSITE}#" \
176 -e "s#^\(Sendmail[ \t]*=\).*#\1 ${SENDMAIL}#" \
177 -e "s#^\(Sendmail2[ \t]*=\).*#\1 ${SENDMAIL2}#" \
178 -e "s#^\(Incoming Work Group[ \t]*=\).*#\1 ${WORKGRP}#" \
179 -e "s#^\(Incoming Work Permissions[ \t]*=\).*#\1 ${WORKPERM}#" \
180 "${S}/etc/MailScanner.conf"
181
182 # update spam.assassin.prefs.conf
183 sed -i -e "s#YOURDOMAIN-COM#${YOURSITE}#" "${S}/etc/spam.assassin.prefs.conf"
184
185 # net-mail/clamav net-mail/f-prot package compatibility
186 sed -i \
187 -e "s#/opt/MailScanner/lib#/usr/lib/MailScanner#" \
188 -e 's#^\(clamav\t.*/usr\)/local$#\1#' \
189 -e 's#^\(f-prot.*\)/usr/local/f-prot$#\1/opt/f-prot#' \
190 "${S}/etc/virus.scanners.conf"
191
192 # update lib files
193 sed -i \
194 -e "s#/opt/MailScanner/bin#$BASEBIN#g" \
195 -e "s#/opt/MailScanner/etc#/etc/MailScanner#g" \
196 -e "s#/opt/MailScanner/lib#/usr/lib/MailScanner#g" \
197 "${S}/lib/MailScanner/ConfigDefs.pl"
198 sed -i \
199 -e "s#/opt/MailScanner/bin#$BASEBIN#g" \
200 -e "s#/opt/MailScanner/etc#/etc/MailScanner#g" \
201 -e "s#/opt/MailScanner/lib#/usr/lib/MailScanner#g" \
202 "${S}/bin/MailScanner"
203 sed -i \
204 -e "s#/opt/MailScanner/bin#$BASEBIN#g" \
205 -e "s#/opt/MailScanner/etc#/etc/MailScanner#g" \
206 -e "s#/opt/MailScanner/lib#/usr/lib/MailScanner#g" \
207 "${S}/bin/update_virus_scanners"
208 sed -i \
209 -e "s#/opt/MailScanner/bin#$BASEBIN#g" \
210 -e "s#/opt/MailScanner/etc#/etc/MailScanner#g" \
211 -e "s#/opt/MailScanner/lib#/usr/lib/MailScanner#g" \
212 "${S}/bin/mailscanner_create_locks"
213 sed -i \
214 -e "s#/etc/MailScanner#/etc/MailScanner#g" \
215 "${S}/lib/MailScanner/CustomConfig.pm"
216
217 # finally, change MailScanner.conf into MailScanner.conf.sample
218 cp "${S}/etc/MailScanner.conf" "${S}/etc/MailScanner.conf.${MY_PV}"
219 mv "${S}/etc/MailScanner.conf" "${S}/etc/MailScanner.conf.sample"
220
221 }
222
223 src_install() {
224 exeinto ${BASE}/sbin
225 doexe bin/MailScanner
226 newexe bin/check_mailscanner check_MailScanner
227 doexe bin/d2mbox bin/df2mbox
228 doexe bin/update_virus_scanners
229 doexe bin/upgrade_MailScanner_conf
230 doexe bin/mailscanner_create_locks
231 doexe bin/Quick.Peek
232 doexe bin/update_bad_phishing_sites bin/update_phishing_sites
233 newexe bin/Sophos.install.linux Sophos.install
234
235 insinto /etc/MailScanner/conf.d
236 doins etc/conf.d/*
237
238 insinto /etc/MailScanner
239 doins etc/*.conf
240 doins etc/mailscanner.conf.with.mcp
241 doins etc/MailScanner.conf.${MY_PV}
242 doins etc/MailScanner.conf.sample
243
244 insinto /etc/MailScanner/rules
245 doins etc/rules/*
246 insinto /etc/MailScanner/mcp
247 doins etc/mcp/*
248
249 insinto /etc/MailScanner
250 doins -r etc/reports
251
252 insinto ${BASE}/$(get_libdir)/MailScanner
253 doins lib/*.prf
254
255 exeinto ${BASE}/$(get_libdir)/MailScanner
256 doexe lib/*-wrapper
257 doexe lib/*-autoupdate
258 doexe lib/*-autoupdate.old
259 doexe lib/*.pm
260
261 exeinto ${BASE}/$(get_libdir)/MailScanner/MailScanner
262 doexe lib/MailScanner/*.pm
263 doexe lib/MailScanner/*.pl
264
265 exeinto ${BASE}/$(get_libdir)/MailScanner/MailScanner/CustomFunctions
266 doexe lib/MailScanner/CustomFunctions/MyExample.pm
267
268 newinitd "${FILESDIR}"/initd.mailscanner MailScanner
269 newconfd "${FILESDIR}"/confd.mailscanner MailScanner
270
271 #Set up cron jobs
272 exeinto /etc/cron.hourly
273 newexe "${S}/bin/cron/check_MailScanner.cron" check_MailScanner
274 for cronfile in update_{virus_scanners,{bad_,}phishing_sites}; do
275 newexe "${S}/bin/cron/${cronfile}.cron" ${cronfile}
276 done
277
278 exeinto /etc/cron.daily
279 newexe "${S}/bin/cron/clean.quarantine.cron" clean.quarantine
280
281 dodoc README
282 insinto /usr/share/doc/${PF}
283 doins MailScanner.conf.index.html
284
285 keepdir /var/spool/MailScanner/incoming
286 keepdir /var/spool/MailScanner/quarantine
287 keepdir /var/spool/MailScanner/spamassassin
288 keepdir /var/spool/MailScanner/archive
289 keepdir ${BASE}/var
290
291 if use postfix ; then
292 chown -R postfix:postfix "${D}/var/spool/MailScanner/"
293 elif use exim ; then
294 chown -R mail:mail "${D}/var/spool/MailScanner/"
295 else
296 keepdir /var/spool/mqueue.in
297 fi
298 use spamassassin && dosym /etc/MailScanner/spam.assassin.prefs.conf /etc/mail/spamassassin/mailscanner.cf
299
300 }
301
302 pkg_postinst() {
303 if use postfix; then
304 elog "Note that postfix 2.4 now supports HOLD of messages"
305 elog "and reinjection without second postfix instance"
306 elog "Inbound path is now ${ROOT}var/spool/postfix/hold"
307 elog
308 elog "See http://mailscanner.info/postfix.html for details"
309 elog "or check (english) gentoo-wiki.com page which has been updated"
310 fi
311
312 if [ -f "/etc/MailScanner/MailScanner.conf" ]; then
313 einfo "Upgrading the MailScanner.conf file"
314 cp /etc/MailScanner/MailScanner.conf /etc/MailScanner/MailScanner.conf.pre_upgrade.${MY_PV}
315 /usr/sbin/upgrade_MailScanner_conf \
316 /etc/MailScanner/MailScanner.conf.pre_upgrade.${MY_PV} \
317 /etc/MailScanner/MailScanner.conf.${MY_PV} \
318 > /etc/MailScanner/MailScanner.conf 2> /dev/null
319 else
320 cp /etc/MailScanner/MailScanner.conf.sample /etc/MailScanner/MailScanner.conf
321 fi
322 }

  ViewVC Help
Powered by ViewVC 1.1.20