Browse code

courier new snap

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