blob: 8cabf22382ee94fc52683ab0b6669f9726db9a00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/postfix/postfix-2.0.11.ebuild,v 1.13 2004/01/11 03:53:34 weeve Exp $
IUSE="ssl mysql sasl ldap ipv6 maildir mbox"
inherit eutils
TLS_P="pfixtls-0.8.13-2.0.10-0.9.7b"
IPV6="1.14"
IPV6_P="ipv6-${IPV6}-pf-${PV}"
IPV6_TLS_P="tls+${IPV6_P}"
DESCRIPTION="A fast and secure drop-in replacement for sendmail"
HOMEPAGE="http://www.postfix.org"
SRC_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official/${P}.tar.gz
ssl? ( ftp://ftp.aet.tu-cottbus.de/pub/postfix_tls/${TLS_P}.tar.gz )
ipv6? ( ftp://ftp.stack.nl/pub/postfix/tls+ipv6/${IPV6}/${IPV6_P}.patch.gz )
ipv6? ( ftp://ftp.stack.nl/pub/postfix/tls+ipv6/${IPV6}/${IPV6_TLS_P}.patch.gz )"
SLOT="0"
LICENSE="IPL-1"
KEYWORDS="x86 sparc ppc amd64 ~alpha"
PROVIDE="virtual/mta
virtual/mda"
DEPEND=">=sys-libs/db-3.2
>=sys-apps/sed-4
>=dev-libs/libpcre-3.4
ldap? ( >=net-nds/openldap-1.2 )
mysql? ( >=dev-db/mysql-3.23.51 )
ssl? ( >=dev-libs/openssl-0.9.6g )
sasl? ( dev-libs/cyrus-sasl )"
RDEPEND="${DEPEND}
>=net-mail/mailbase-0.00
!virtual/mta"
is_postfix_installed() {
if [ -d /etc/postfix ] ; then
return 1
fi
return 0
}
pkg_setup() {
if ! grep -q ^postdrop: /etc/group ; then
groupadd postdrop || die "problem adding group postdrop"
fi
if ! grep -q ^mail:.*postfix /etc/group ; then
usermod -G mail postfix || die "problem adding user postfix to group mail"
fi
# Prevent mangling the smtpd.conf file
if [ ! -L ${ROOT}/usr/lib/sasl2/smtpd.conf ]
then
if [ -f ${ROOT}/usr/lib/sasl2/smtpd.conf ]
then
ebegin "Protecting your smtpd.conf file"
if [ ! -d ${ROOT}/etc/sasl2 ]
then
mkdir -p ${ROOT}/etc/sasl2
fi
# This shouldn't be necessary, but apparently
# Without it things can still get messy.
if [ -L ${ROOT}/etc/sasl2/smtpd.conf ]
then
rm ${ROOT}/etc/sasl2/smtpd.conf
fi
# If both files exist, make sure that we
# preserve a copy of each with the ._cfg
# system
if [ -f ${ROOT}/etc/sasl2/smtpd.conf ]
then
mv ${ROOT}/etc/sasl2/smtpd.conf \
${ROOT}/etc/sasl2/._cfg0000_smtpd.conf
fi
mv ${ROOT}/usr/lib/sasl2/smtpd.conf ${ROOT}/etc/sasl2
eend
fi
fi
}
src_unpack() {
unpack ${P}.tar.gz
cd ${S}
if [ "`use ssl`" ]; then
if [ "`use ipv6`" ]; then
epatch ${DISTDIR}/${IPV6_TLS_P}.patch.gz
else
unpack ${TLS_P}.tar.gz
epatch ${WORKDIR}/${P}/${TLS_P}/pfixtls.diff
fi
CCARGS="${CCARGS} -DHAS_SSL"
AUXLIBS="${AUXLIBS} -lssl -lcrypto"
elif [ "`use ipv6`" ]; then
epatch ${DISTDIR}/${IPV6_P}.patch.gz
fi
cd ${S}/conf
sed -i -e "s:/usr/libexec/postfix:/usr/lib/postfix:" main.cf
if [ "`use sasl`" ] ; then
# sasl 2
if [ -f /usr/include/sasl/sasl.h ]; then
AUXLIBS="${AUXLIBS} -lsasl2"
CCARGS="${CCARGS} -I/usr/include/sasl -DUSE_SASL_AUTH"
# sasl 1
elif [ -f /usr/include/sasl.h ]; then
AUXLIBS="${AUXLIBS} -lsasl"
CCARGS="${CCARGS} -DUSE_SASL_AUTH"
fi
fi
cd ${S}/src/global
sed -i -e "s:/usr/libexec/postfix:/usr/lib/postfix:" mail_params.h
if [ "`use mysql`" ] ; then
CCARGS="${CCARGS} -DHAS_MYSQL -I/usr/include/mysql"
AUXLIBS="${AUXLIBS} -lmysqlclient -lm -lz"
fi
if [ "`use ldap`" ] ; then
CCARGS="${CCARGS} -DHAS_LDAP"
AUXLIBS="${AUXLIBS} -lldap -llber"
fi
if [ "`use pam`" ] ; then
AUXLIBS="${AUXLIBS} -lpam"
fi
CCARGS="${CCARGS} -DHAS_PCRE"
AUXLIBS="${AUXLIBS} -L/usr/lib -lpcre -ldl -lcrypt"
DEBUG=""
cd ${S}
make makefiles CC="${CC}" OPT="${CFLAGS}" DEBUG="${DEBUG}" \
CCARGS="${CCARGS}" AUXLIBS="${AUXLIBS}" \
|| die "creating makefiles failed"
# Postfix do not get the FQDN if no hostname is configured
epatch ${FILESDIR}/${PN}-2.0.9-get-FQDN.patch
}
src_compile() {
#this is a bug fix for gcc-2.95.3-r5 (bug 16547)
export CC=gcc
emake || die "compile problem"
}
src_install () {
dodir /usr/bin /usr/sbin /usr/lib/postfix /etc/postfix/sample
keepdir /var/spool/postfix/tmp
cd ${S}/bin
dosbin post* sendmail
fowners root:postdrop /usr/sbin/{postdrop,postqueue}
fperms 2755 /usr/sbin/{postdrop,postqueue}
dosym /usr/sbin/sendmail /usr/bin/mailq
dosym /usr/sbin/sendmail /usr/bin/newaliases
dosym /usr/sbin/sendmail /usr/lib/sendmail
cd ${S}/libexec
exeinto /usr/lib/postfix
doexe *
cd ${S}/man
doman man*/*
cd ${S}
dodoc *README COMPATIBILITY HISTORY INSTALL LICENSE PORTING RELEASE_NOTES*
cd README_FILES
find . -type l |xargs rm
dodoc *
cd ${S}
dohtml html/*
cd ${S}/conf
insinto /etc/postfix/sample
doins access aliases canonical pcre_table regexp_table \
relocated transport virtual *.cf
exeinto /etc/postfix
doexe postfix-script post-install postfix-files
insinto /etc/postfix
doins ${S}/conf/{main,master}.cf ${FILESDIR}/saslpass
cd ${D}/etc/postfix
epatch ${FILESDIR}/postfix-2.0.0/main.cf.diff
sed -i -e "s|/usr/share/doc/POSTFIX|/usr/share/doc/${PF}|" main.cf
chmod 644 main.cf
rm -f main.cf~
fperms 600 /etc/postfix/saslpass
exeinto /etc/init.d ; doexe ${FILESDIR}/postfix
insinto /etc/pam.d ; newins ${FILESDIR}/smtp.pam smtp
insinto /etc/sasl2
doins ${FILESDIR}/smtpd-2.0.conf smtpd.conf
if [ "`use sasl`" ] ; then
dodir /usr/lib/sasl2
dosym ../../../etc/sasl2/smtpd.conf /usr/lib/sasl2/smtpd.conf
fi
cd ${D}/etc/postfix
if [ "`use maildir`" ]; then
sed -i -e "s:^#\(home_mailbox = \)Maildir/:\1.maildir/:" main.cf
elif [ "`use mbox`" ]; then
sed -i -e "s:^#\(mail_spool_directory = /var/spool/mail\):\1:" main.cf
fi
#install an rmail for UUCP, closing bug #19127
cd ${S}/auxiliary/rmail
dobin rmail
}
pkg_postinst() {
install -d -m 0755 ${ROOT}/var/spool/postfix
ewarn "If you upgraded from <postfix-2, you must revisit your configuration files."
ewarn "See /usr/share/doc/${PF}/RELEASE_NOTES for a list of changes."
if [ ! -e /etc/mail/aliases.db ] ; then
echo
ewarn "You must edit /etc/mail/aliases to suit your needs and then run"
ewarn "/usr/bin/newaliases. Postfix will not work correctly without it."
fi
}
|