/[gentoo-x86]/mail-mta/qmail-ldap/qmail-ldap-1.03-r4.ebuild
Gentoo

Contents of /mail-mta/qmail-ldap/qmail-ldap-1.03-r4.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Sat Jun 16 13:48:10 2007 UTC (12 years, 4 months ago) by hollow
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -1 lines
FILE REMOVED
sync with netqmail-1.05-r8 ebuild; fix #62734, #65456, #82089, #97957, #125162 and hopefully #83092; old versions are completely broken, therefore removed
(Portage version: 2.1.2.9)

1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/mail-mta/qmail-ldap/qmail-ldap-1.03-r4.ebuild,v 1.11 2007/04/28 23:17:35 swegener Exp $
4
5 IUSE="ssl"
6
7 inherit eutils fixheadtails toolchain-funcs
8
9 S=${WORKDIR}/qmail-${PV}
10
11 DESCRIPTION="A modern replacement for sendmail which uses maildirs"
12 HOMEPAGE="http://www.qmail.org/
13 http://www.jedi.claranet.fr/qmail-tuning.html
14 http://iain.cx/unix/qmail/mysql.php
15 http://www.nrg4u.com/"
16 SRC_URI="mirror://qmail/qmail-${PV}.tar.gz
17 http://www.suspectclass.com/~sgifford/qmail/qmail-0.0.0.0.patch
18 http://www.nrg4u.com/qmail/qmail-ldap-1.03-20040401.patch.gz
19 mirror://gentoo/${P}-r2-tls.patch.bz2"
20
21 DEPEND="virtual/libc
22 sys-libs/zlib
23 sys-apps/groff
24 >=net-nds/openldap-2.1.23
25 >=sys-apps/ucspi-tcp-0.88
26 >=net-mail/checkpassword-0.90
27 ssl? ( >=dev-libs/openssl-0.9.6e )
28 >=net-mail/queue-fix-1.4-r1"
29
30
31 RDEPEND="!virtual/mta
32 ${DEPEND}
33 >=sys-process/daemontools-0.76-r1
34 >=net-mail/dot-forward-0.71"
35
36 PROVIDE="virtual/mta
37 virtual/mda"
38
39 SLOT="0"
40 LICENSE="as-is"
41 KEYWORDS="~x86 ~ppc ~sparc"
42
43 src_unpack() {
44 unpack qmail-1.03.tar.gz
45 unpack qmail-ldap-1.03-20040401.patch.gz
46
47 cd ${S}
48
49 #main ldap patch
50 #includes : qmail-queue patch | big todo | errno
51 #qmail-103.patch | qmail-local-tabs.patch | big-concurrency.patch
52 epatch ${WORKDIR}/qmail-ldap-1.03-20040401.patch || die "ldap patch failed"
53
54 #define 0.0.0.0 as local system/network
55 epatch ${DISTDIR}/qmail-0.0.0.0.patch || die "0.0.0.0 patch did not apply"
56
57 # AUTOHOME DIR MAKE AND FEATURES PATCH
58 epatch ${FILESDIR}/${PV}-${PR}/gentoo.patch || die "Homedir patch did not apply"
59
60 # Account for Linux filesystems lack of a synchronus link()
61 epatch ${FILESDIR}/qmail-link-sync-gentoo.patch || die "linksync patch did not apply"
62
63 # Lets make Aiko Barz very happy with his patch, this allows you to use a
64 # pipe in deliverpath.
65 epatch ${FILESDIR}/${PV}-${PR}/pipehack.patch.bz2 || die "pipehack did not apply correctly"
66
67 # make the qmail 'sendmail' binary behave like sendmail's for -f
68 #BROKEN
69 #epatch ${DISTDIR}/sendmail-flagf.patch
70
71 # This will make the emails headers be written in localtime rather than GMT
72 # If you really want, uncomment it yourself, as mail really should be in GMT
73 #epatch ${DISTDIR}/qmail-date-localtime.patch.txt || die "qmail-date-localtime.patch did not apply"
74
75 if use ssl; then
76 epatch ${FILESDIR}/${PV}-${PR}/tls.patch.bz2 || die "tls+auth patch failed";
77 fi
78
79 echo -n "$(tc-getCC) ${CFLAGS}" >${S}/conf-cc
80 echo -n "$(tc-getCC) ${LDFLAGS}" > ${S}/conf-ld
81 echo "500" > conf-spawn
82
83 }
84
85 src_compile() {
86 cd ${S}
87 emake it man ldap|| die
88 }
89
90
91
92 src_install() {
93 cd ${S}
94
95 einfo "Setting up directory hierarchy ..."
96
97 diropts -m 755 -o root -g qmail
98 dodir /var/qmail
99
100 for i in bin boot control
101 do
102 dodir /var/qmail/${i}
103 done
104
105 keepdir /var/qmail/users
106
107 diropts -m 755 -o alias -g qmail
108 dodir /var/qmail/alias
109
110 einfo "Installing the qmail software ..."
111
112 insopts -o root -g qmail -m 755
113 insinto /var/qmail/boot
114 doins home home+df proc proc+df binm1 binm1+df binm2 binm2+df binm3 binm3+df
115
116 into /usr
117 dodoc ${FILESDIR}/samples.ldif
118 dodoc FAQ UPGRADE SENDMAIL INSTALL* TEST* REMOVE* PIC* SECURITY
119 dodoc SYSDEPS TARGETS THANKS THOUGHTS TODO VERSION
120
121 insopts -o qmailq -g qmail -m 4711
122 insinto /var/qmail/bin
123 doins qmail-queue
124
125 insopts -o root -g qmail -m 700
126 insinto /var/qmail/bin
127 doins qmail-lspawn qmail-start qmail-newu qmail-newmrh
128
129 insopts -o root -g qmail -m 711
130 insinto /var/qmail/bin
131 doins qmail-getpw qmail-local qmail-remote qmail-rspawn \
132 qmail-clean qmail-send splogger qmail-pw2u
133
134 insopts -o root -g qmail -m 755
135 insinto /var/qmail/bin
136 doins qmail-inject predate datemail mailsubj qmail-showctl \
137 qmail-qread qmail-qstat qmail-tcpto qmail-tcpok qmail-pop3d \
138 qmail-popup qmail-qmqpc qmail-qmqpd qmail-qmtpd qmail-smtpd \
139 sendmail tcp-env qreceipt qsmhook qbiff forward preline \
140 condredirect bouncesaying except maildirmake maildir2mbox \
141 maildirwatch qail elq pinq config-fast auth_imap auth_pop \
142 auth_smtp dirmaker qmail-ldaplookup qmail-todo
143
144 into /usr
145 for i in *.1 *.5 *.8
146 do
147 doman $i
148 done
149
150 einfo "Adding env.d entry for qmail"
151 doenvd ${FILESDIR}/${PV}-${PR}/99qmail
152
153
154 einfo "Creating sendmail replacement ..."
155 diropts -m 755
156 dodir /usr/sbin /usr/lib
157 dosym /var/qmail/bin/sendmail /usr/sbin/sendmail
158 dosym /var/qmail/bin/sendmail /usr/lib/sendmail
159
160 einfo "Setting up the default aliases ..."
161 diropts -m 700 -o alias -g qmail
162 ${D}/var/qmail/bin/maildirmake ${D}/var/qmail/alias/.maildir
163 # for good measure
164 keepdir /var/qmail/alias/.maildir/{cur,new,tmp}
165
166 for i in mailer-daemon postmaster root
167 do
168 if [ ! -f ${ROOT}/var/qmail/alias/.qmail-${i} ]; then
169 touch ${D}/var/qmail/alias/.qmail-${i}
170 fowners alias:qmail /var/qmail/alias/.qmail-${i}
171 fi
172 done
173
174 einfo "Setting up maildirs by default in the account skeleton ..."
175 diropts -m 755 -o root -g root
176 insinto /etc/skel
177 newins ${FILESDIR}/${PV}-${PR}/dot_qmail .qmail.sample
178 fperms 644 /etc/skel/.qmail.sample
179 ${D}/var/qmail/bin/maildirmake ${D}/etc/skel/.maildir
180 # for good measure
181 keepdir /etc/skel/.maildir/{cur,new,tmp}
182
183 einfo "Setting up all services (send, smtp, qmtp, qmqp, pop3) ..."
184 insopts -o root -g root -m 755
185 diropts -m 755 -o root -g root
186 dodir /var/qmail/supervise
187
188 for i in send smtpd qmtpd qmqpd pop3d; do
189 insopts -o root -g root -m 755
190 diropts -m 755 -o root -g root
191 dodir /var/qmail/supervise/qmail-${i}{,/log}
192 diropts -m 755 -o qmaill
193 keepdir /var/log/qmail/qmail-${i}
194 fperms +t /var/qmail/supervise/qmail-${i}{,/log}
195 insinto /var/qmail/supervise/qmail-${i}
196 newins ${FILESDIR}/${PV}-${PR}/run-qmail${i} run
197 insinto /var/qmail/supervise/qmail-${i}/log
198 newins ${FILESDIR}/${PV}-${PR}/run-qmail${i}log run
199 done
200
201 for i in smtp qmtp qmqp pop3; do
202 insopts -o root -groot -m 644
203 diropts -m 755 -o root -g root
204 dodir /etc
205 insinto /etc
206 if [ -f ${FILESDIR}/tcp.${i}.sample ]; then
207 newins ${FILESDIR}/tcp.${i}.sample tcp.${i}
208 fi
209 if [ -f ${D}/etc/tcp.${i} ]; then
210 tcprules ${D}/etc/tcp.${i}.cdb ${D}/etc/.tcp.${i}.tmp \
211 < ${D}/etc/tcp.${i}
212 fi
213 done
214
215 einfo "Installing the qmail control file ..."
216 exeinto /var/qmail/bin
217 doexe ${FILESDIR}/${PV}-${PR}/qmail-control
218
219 einfo "Installing the qmail startup file ..."
220 insopts -o root -g root -m 755
221 insinto /var/qmail
222 doins ${FILESDIR}/${PV}-${PR}/rc \
223
224 einfo "Installing the qmail configuration file ..."
225 insinto /var/qmail/control
226 insopts -o root -g root -m 644
227 doins ${FILESDIR}/control/defaultdomain \
228 ${FILESDIR}/control/defaulthost \
229 ${FILESDIR}/control/dirmaker \
230 ${FILESDIR}/control/ldapbasedn \
231 ${FILESDIR}/control/ldapgid \
232 ${FILESDIR}/control/ldaplocaldelivery \
233 ${FILESDIR}/control/ldaplogin \
234 ${FILESDIR}/control/ldapmessagestore \
235 ${FILESDIR}/control/ldapserver \
236 ${FILESDIR}/control/ldapuid \
237 ${FILESDIR}/control/qmail-pop3d-loglevel \
238 ${FILESDIR}/control/qmail-pop3d-softlimit \
239 ${FILESDIR}/control/qmail-smtpd-softlimit \
240 ${FILESDIR}/control/qmail-start-loglevel
241
242 insopts -o qmaild -g root -m 600
243 insinto /var/qmail/control
244 doins ${FILESDIR}/control/ldappassword
245
246 einfo "Installing the qmail.schema ..."
247 insinto /etc/openldap/schema
248 doins qmail.schema
249
250 einfo "Insalling some stock configuration files"
251 insinto /var/qmail/control
252 insopts -o root -g root -m 644
253 doins ${FILESDIR}/${PV}-${PR}/conf-*
254 newins ${FILESDIR}/${PV}-${PR}/dot_qmail defaultdelivery
255 use ssl && doins ${FILESDIR}/${PV}-${PR}/servercert.cnf
256
257 einfo "Configuration sanity checker"
258 into /var/qmail
259 insopts -o root -g root -m 644
260 dobin ${FILESDIR}/${PV}-${PR}/config-sanity-check
261
262 if use ssl; then
263 einfo "SSL Certificate creation script"
264 dobin ${FILESDIR}/${PV}-${PR}/mkservercert
265 einfo "RSA key generation cronjob"
266 insinto /etc/cron.daily
267 doins ${FILESDIR}/${PV}-${PR}/qmail-genrsacert.sh
268 chmod +x ${D}/etc/cron.daily/qmail-genrsacert.sh
269 fi
270 }
271
272 rootmailfixup() {
273 # so you can check mail as root easily
274 local TMPCMD="ln -sf /var/qmail/alias/.maildir/ ${ROOT}/root/.maildir"
275 if [ -d "${ROOT}/root/.maildir" ] && [ ! -L "${ROOT}/root/.maildir" ] ; then
276 elog "Previously the qmail ebuilds created /root/.maildir/ but not"
277 elog "mail was every delivered there. If the directory does not"
278 elog "contain any mail, please delete it and run:"
279 elog "${TMPCMD}"
280 else
281 ${TMPCMD}
282 fi
283 chown -R alias:qmail ${ROOT}/var/qmail/alias/.maildir 2>/dev/null
284 }
285
286 buildtcprules() {
287 for i in smtp qmtp qmqp pop3; do
288 # please note that we don't check if it exists
289 # as we want it to make the cdb files anyway!
290 cat ${ROOT}etc/tcp.${i} 2>/dev/null | tcprules ${ROOT}etc/tcp.${i}.cdb ${ROOT}etc/.tcp.${i}.tmp
291 done
292 }
293
294
295 pkg_postinst() {
296 einfo "Setting up the message queue hierarchy ..."
297 # queue-fix makes life easy!
298 /var/qmail/bin/queue-fix ${ROOT}/var/qmail/queue >/dev/null
299
300 rootmailfixup
301 buildtcprules
302
303 # for good measure
304 env-update
305
306 if [ "`getent group ldapauth | cut -d: -f1`" != "ldapauth" ]; then
307 groupadd ldapauth &>/dev/null
308 fi
309
310 if [ "`getent passwd ldapauth | cut -d: -f1`" != "ldapauth" ]; then
311 useradd -g ldapauth -d /var/qmail/maildirs -s /bin/true -u 11184 ldapauth
312 fi
313
314
315 elog "Please do not forget to run, the following syntax :"
316 elog "emerge --config =${PF} "
317 elog "This will setup qmail to run out-of-the-box on your system including SSL. "
318 elog
319 elog "To start qmail at boot you have to enable the /etc/init.d/svscan rc file "
320 elog "and create the following links : "
321 elog "ln -s /var/qmail/supervise/qmail-send /service/qmail-send "
322 elog "ln -s /var/qmail/supervise/qmail-smtpd /service/qmail-smtpd "
323 elog "ln -s /var/qmail/supervise/qmail-pop3d /service/qmail-pop3d "
324 elog
325 elog "NOTE: Please check your /var/qmail/control/ldap* files to match your local "
326 elog "ldap settings and add the qmail.schema along with \"allow bind_v2\" to your "
327 elog "slapd.conf. For sample ldifs, please check "
328 elog "/usr/share/doc/${PF}/samples.ldif.gz "
329 }
330
331 pkg_config() {
332
333 # avoid some weird locale problems
334 export LC_ALL="C"
335
336 if [ ${ROOT} = "/" ] ; then
337 if [ ! -f ${ROOT}var/qmail/control/me ] ; then
338 export qhost=`hostname --fqdn`
339 ${ROOT}var/qmail/bin/config-fast $qhost
340 fi
341 else
342 ewarn "Skipping some configuration as it MUST be run on the final host"
343 fi
344
345 einfo "Accepting relaying by default from all ips configured on this machine."
346 LOCALIPS=`/sbin/ifconfig | grep inet | cut -d' ' -f 12 -s | cut -b 6-20`
347 if use ssl; then
348 TCPSTRING=":allow,SMTPAUTH=\"TLSREQUIRED\"";
349 else
350 TCPSTRING=":allow,RELAYCLIENT=\"\",RBLSMTPD=\"\""
351 fi
352 for ip in $LOCALIPS; do
353 myline="${ip}${TCPSTRING}"
354 for proto in smtp qmtp qmqp; do
355 f="${ROOT}etc/tcp.${proto}"
356 egrep -q "${myline}" ${f} || echo "${myline}" >>${f}
357 done
358 done
359
360 buildtcprules
361
362 if use ssl; then
363 ${ROOT}etc/cron.daily/qmail-genrsacert.sh
364 einfo "Creating a self-signed ssl-certificate:"
365 /var/qmail/bin/mkservercert
366 einfo "If you want to have a properly signed certificate "
367 einfo "instead, do the following:"
368 einfo "openssl req -new -nodes -out req.pem \\"
369 einfo "-config /var/qmail/control/servercert.cnf \\"
370 einfo "-keyout /var/qmail/control/servercert.pem"
371 einfo "Send req.pem to your CA to obtain signed_req.pem, and do:"
372 einfo "cat signed_req.pem >> /var/qmail/control/servercert.pem"
373 fi
374 }

  ViewVC Help
Powered by ViewVC 1.1.20