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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20