courier bump
Hanno Böck

Hanno Böck commited on 2010-02-02 14:47:38
Zeige 1 geänderte Dateien mit 299 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,299 @@
1
+# Copyright 1999-2009 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/mail-mta/courier/courier-0.63.0.ebuild,v 1.2 2009/12/26 17:37:07 pva Exp $
4
+
5
+inherit eutils flag-o-matic
6
+
7
+DESCRIPTION="An MTA designed specifically for maildirs"
8
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
9
+HOMEPAGE="http://www.courier-mta.org/"
10
+SLOT="0"
11
+LICENSE="GPL-2"
12
+# not in keywords due to missing dependencies: ~arm ~s390 ~ppc64 ~mips
13
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~sparc ~x86"
14
+IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite mailwrapper \
15
+	fam web webmail"
16
+
17
+PROVIDE="virtual/mta
18
+	 virtual/mda
19
+	 virtual/imapd"
20
+
21
+DEPEND="
22
+	>=net-libs/courier-authlib-0.61.0
23
+	>=dev-libs/openssl-0.9.6
24
+	>=sys-libs/gdbm-1.8.0
25
+	dev-libs/libpcre
26
+	app-misc/mime-types
27
+	fax? ( >=media-libs/netpbm-9.12 app-text/ghostscript-gpl >=net-dialup/mgetty-1.1.28 )
28
+	pam? ( virtual/pam )
29
+	mysql? ( virtual/mysql )
30
+	ldap? ( >=net-nds/openldap-1.2.11 )
31
+	postgres? ( virtual/postgresql-base )
32
+	spell? ( virtual/aspell-dict )
33
+	fam? ( virtual/fam )
34
+	!mailwrapper? ( !virtual/mta )
35
+	!virtual/imapd
36
+	!mail-filter/maildrop"
37
+
38
+RDEPEND="${DEPEND}
39
+	dev-lang/perl
40
+	sys-process/procps"
41
+
42
+PDEPEND="mailwrapper? ( >=net-mail/mailwrapper-0.2 )
43
+	pam? ( net-mail/mailbase )
44
+	crypt? ( >=app-crypt/gnupg-1.0.4 )"
45
+
46
+src_unpack() {
47
+	unpack ${A}
48
+	cd "${S}"
49
+	epatch "${FILESDIR}/courier-0.64.0-tarpit-option.diff"
50
+	use norewrite && epatch "${FILESDIR}/norewrite.patch"
51
+}
52
+
53
+src_compile() {
54
+	filter-flags '-fomit-frame-pointer'
55
+
56
+	local myconf
57
+	myconf=""
58
+
59
+	use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf"
60
+
61
+	econf ${myconf} \
62
+		$(use_with fam) \
63
+		$(use_with ipv6) \
64
+		$(use_with spell ispell) \
65
+		$(use_with ldap ldapaliasd) \
66
+		$(use_enable ldap maildroldap) \
67
+		--enable-mimetypes=/etc/mime.types \
68
+		--prefix=/usr \
69
+		--disable-root-check \
70
+		--mandir=/usr/share/man \
71
+		--sysconfdir=/etc/courier \
72
+		--libexecdir=/usr/$(get_libdir)/courier \
73
+		--datadir=/usr/share/courier \
74
+		--sharedstatedir=/var/lib/courier/com \
75
+		--localstatedir=/var/lib/courier \
76
+		--with-piddir=/var/run/courier \
77
+		--with-authdaemonvar=/var/lib/courier/authdaemon \
78
+		--with-mailuser=mail \
79
+		--with-mailgroup=mail \
80
+		--with-paranoid-smtpext \
81
+		--with-db=gdbm \
82
+		--disable-autorenamesent \
83
+		--cache-file="${S}/configuring.cache" \
84
+		--host="${CHOST}" debug=true || die "./configure"
85
+	sed -e'/^install-perms-local:/a\	sed -e\"s|^|'"${D}"'|g\" -i permissions.dat' -i Makefile
86
+	emake || die "Compile problem"
87
+}
88
+
89
+etc_courier() {
90
+	# Import existing /etc/courier/file if it exists.
91
+	# Add option only if it was not already set or even commented out
92
+	file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
93
+	[ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
94
+			cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
95
+	grep -q "${word}" "${D}/etc/courier/${file}" || \
96
+		echo "${2}" >> "${D}/etc/courier/${file}"
97
+}
98
+
99
+etc_courier_chg() {
100
+	file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
101
+	[ -z "${section}" ] && section="${2}"
102
+	grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
103
+	sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file}
104
+}
105
+
106
+src_install() {
107
+	local f
108
+	diropts -o mail -g mail
109
+	keepdir /var/run/courier
110
+	keepdir /var/lib/courier/tmp
111
+	keepdir /var/lib/courier/msgs
112
+	make install DESTDIR="${D}" || die "install"
113
+	make install-configure || die "install-configure"
114
+
115
+	# Get rid of files we dont want
116
+	if ! use webmail ; then
117
+		cd "${D}"
118
+		cat "${FILESDIR}/webmail_files" | xargs rm -rf
119
+	fi
120
+
121
+	if ! use web ; then
122
+		cd "${D}"
123
+		cat "${FILESDIR}/webadmin_files" | xargs rm -rf
124
+	fi
125
+
126
+	for dir2keep in $(cd "${D}" && find ./var/lib/courier -type d) ; do
127
+		keepdir "$dir2keep" || die "failed running keepdir: $dir2keep"
128
+	done
129
+
130
+	newinitd "${FILESDIR}/courier-init-r2" "courier"
131
+	use fam || sed -i -e's|^.*use famd$||g' "${D}/etc/init.d/courier"
132
+
133
+	cd "${D}/etc/courier"
134
+	if use webmail ; then
135
+		insinto /etc/courier
136
+		newins "${FILESDIR}/apache-sqwebmail.inc" apache-sqwebmail.inc
137
+	fi
138
+
139
+	for f in *.dist ; do cp "${f}" "${f%%.dist}" ; done
140
+	if use ldap ; then
141
+		[ -e ldapaliasrc ] &&  ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
142
+	else
143
+		rm -f ldapaliasrc
144
+	fi
145
+
146
+	( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
147
+		> "${D}/etc/courier/sizelimit"
148
+	etc_courier maildroprc ""
149
+	etc_courier esmtproutes ""
150
+	etc_courier backuprelay ""
151
+	etc_courier locallowercase ""
152
+	etc_courier bofh "opt BOFHBADMIME=accept"
153
+	etc_courier bofh "opt BOFHSPFTRUSTME=1"
154
+	etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
155
+	etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
156
+	etc_courier bofh "opt BOFHSPFFROM=all"
157
+	etc_courier bofh "opt BOFHSPFMAILFROM=all"
158
+	etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
159
+	etc_courier esmtpd "BOFHBADMIME=accept"
160
+	etc_courier esmtpd-ssl "BOFHBADMIME=accept"
161
+	etc_courier esmtpd-msa "BOFHBADMIME=accept"
162
+
163
+	use fam && etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
164
+	use fam || etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256"
165
+
166
+	# Fix for a sandbox violation on subsequential merges
167
+	# - ticho@gentoo.org, 2005-07-10
168
+	rm "${D}"/usr/sbin/{pop3d,imapd}{,-ssl}
169
+	dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
170
+	dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
171
+	dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
172
+	dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
173
+
174
+	cd "${S}"
175
+	cp imap/README README.imap
176
+	use nls && cp unicode/README README.unicode
177
+	dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
178
+	dodoc tcpd/README.couriertls
179
+	mv "${D}/usr/share/courier/htmldoc" "${D}/usr/share/doc/${P}/html"
180
+
181
+	if use webmail ; then
182
+		insinto /usr/$(get_libdir)/courier/courier
183
+		insopts -m 755 -o mail -g mail
184
+		doins "${S}/courier/webmaild"
185
+	fi
186
+
187
+	if use web ; then
188
+		insinto /etc/courier/webadmin
189
+		insopts -m 400 -o mail -g mail
190
+		doins "${FILESDIR}/password.dist"
191
+	fi
192
+
193
+	# avoid name collisions in /usr/sbin, make webadmin match
194
+	cd "${D}/usr/sbin"
195
+	for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv "${f}" "courier-${f}" ; done
196
+	if use web ; then
197
+		sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \
198
+			-e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \
199
+			"${D}/usr/share/courier/courierwebadmin/admin-40imap.pl" \
200
+			|| ewarn "failed to fix webadmin"
201
+		sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \
202
+			-e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \
203
+			"${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl" \
204
+			|| ewarn "failed to fix webadmin"
205
+	fi
206
+
207
+	# users should be able to send mail. Could be restricted with suictl.
208
+	chmod u+s "${D}/usr/bin/sendmail"
209
+
210
+	if use mailwrapper ; then
211
+		mv "${D}/usr/bin/sendmail" "${D}/usr/bin/sendmail.courier"
212
+		mv "${D}/usr/bin/rmail" "${D}/usr/bin/rmail.courier"
213
+		mv "${D}/usr/bin/mailq" "${D}/usr/bin/mailq.courier"
214
+
215
+		mv "${D}/usr/share/man/man1/sendmail.1" \
216
+			"${D}/usr/share/man/man1/sendmail-courier.1"
217
+		mv "${D}/usr/share/man/man1/mailq.1" \
218
+			"${D}/usr/share/man/man1/mailq-courier.1"
219
+		mv "${D}/usr/share/man/man1/rmail.1" \
220
+			"${D}/usr/share/man/man1/rmail-courier.1"
221
+
222
+		insopts -m 444 -o mail -g mail
223
+		insinto /etc/mail
224
+		doins "${FILESDIR}/mailer.conf"
225
+	else
226
+		dosym /usr/bin/sendmail /usr/sbin/sendmail
227
+	fi
228
+}
229
+
230
+src_test() {
231
+	if [ `whoami` != 'root' ]; then
232
+		emake -j1 check || die "Make check failed."
233
+	else
234
+		einfo "make check skipped, can't run as root."
235
+		einfo "You can enable it with FEATURES=\"userpriv\""
236
+	fi
237
+}
238
+
239
+pkg_postinst() {
240
+	use fam && elog "fam daemon is needed for courier-imapd" \
241
+		|| ewarn "courier was built without fam support"
242
+}
243
+
244
+pkg_config() {
245
+	mailhost="$(hostname)"
246
+	export mailhost
247
+
248
+	domainname="$(domainname)"
249
+	if [ "x$domainname" = "x(none)" ] ; then
250
+		domainname="$(echo ${mailhost} | sed -e "s/[^\.]*\.\(.*\)/\1/")"
251
+	fi
252
+	export domainname
253
+
254
+	if [ "${ROOT}" = "/" ] ; then
255
+		file="${ROOT}/etc/courier/locals"
256
+		if [ ! -f "${file}" ] ; then
257
+			echo "localhost" > "${file}";
258
+			echo "${domainname}" >> "${file}";
259
+		fi
260
+		file="${ROOT}/etc/courier/esmtpacceptmailfor.dir/${domainname}"
261
+		if [ ! -f "${file}" ] ; then
262
+			echo "${domainname}" > "${file}"
263
+			/usr/sbin/makeacceptmailfor
264
+		fi
265
+
266
+		file="${ROOT}/etc/courier/smtpaccess/${domainname}"
267
+		if [ ! -f "${file}" ]
268
+		then
269
+			netstat -nr | grep "^[1-9]" | while read network gateway netmask rest
270
+			do
271
+				i=1
272
+				net=""
273
+				TIFS="${IFS}"
274
+				IFS="."
275
+				for o in "${netmask}"
276
+				do
277
+					if [ "${o}" == "255" ]
278
+					then
279
+						[ "_${net}" == "_" ] || net="${net}."
280
+						t="$(echo "${network}" | cut -d " " -f ${i})"
281
+						net="${net}${t}"
282
+					fi
283
+					i="$((${i} + 1))"
284
+				done
285
+				IFS="${TIFS}"
286
+				echo "doing configuration - relay control for the network ${net} !"
287
+				echo "${net}	allow,RELAYCLIENT" >> ${file}
288
+			done
289
+			/usr/sbin/makesmtpaccess
290
+		fi
291
+	fi
292
+
293
+	echo "creating cert for esmtpd-ssl:"
294
+	/usr/sbin/mkesmtpdcert
295
+	echo "creating cert for imapd-ssl:"
296
+	/usr/sbin/mkpop3dcert
297
+	echo "creating cert for pop3d-ssl:"
298
+	/usr/sbin/mkimapdcert
299
+}
0 300