# $Header: /magellan-cvs/smage/dovecot/dovecot-1.0.13-r1.smage2,v 1.1 2008/03/17 16:36:11 niro Exp $ PNAME="dovecot" PVER="1.0.13" PBUILD="r1" PCATEGORIE="net-mail" STATE="unstable" DESCRIPTION="Dovecot is an IMAP and POP3 server written with security primarily in mind." HOMEPAGE="http://dovecot.org/" DEPEND=">= net-mail/mail-base-files-0.1 >= sys-libs/pam-0.99 >= dev-libs/openssl-0.9.8 >= net-nds/openldap-2.4 >= dev-db/mysql5-5" SRCFILE="${PNAME}-${PVER}.tar.gz" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" sminclude mtools SRC_URI=( http://dovecot.org/releases/${PVER%.*}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/dovecot.rc mirror://${PNAME}/${PNAME}-1.0.5-magellan-defaults.patch mirror://${PNAME}/${PNAME}-1.0.5-config-install-2.patch mirror://${PNAME}/${PNAME}-1.0.5-ssl-fixes.patch ) src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # apply out default settings mpatch ${PNAME}-1.0.5-magellan-defaults.patch || die # install only devcot.conf and not any examples to /etc/dovecot mpatch ${PNAME}-1.0.5-config-install-2.patch || die # fix ssl pathes in mkcert.sh to match out default settings mpatch ${PNAME}-1.0.5-ssl-fixes.patch || die } src_compile() { cd ${SRCDIR} mconfigure \ --sysconfdir=/etc/dovecot \ --localstatedir=/var \ --enable-header-install \ --enable-ipv6 \ --disable-debug \ --with-ioloop=best \ --with-poll=best \ --with-ssl=openssl \ --with-ssldir=/etc/dovecot/ssl \ --with-ldap \ --with-mysql \ --with-pam \ || die mmake || die } src_install() { cd ${SRCDIR} mmake DESTDIR=${BINDIR} install || die # we're using pam files (imap and pop3) provided by mailbase sed -i '/passdb pam/, /^[ \t]*}/ s|#args = dovecot|args = "\*"|' \ ${BINDIR}/etc/dovecot/dovecot.conf || die # install our initscript minstallrc dovecot.rc dovecot || die # install ssl-cert creation script and config minstalldir /etc/dovecot/ssl || die minstallfile doc/dovecot-openssl.cnf /etc/dovecot/ssl/ || die minstallexec doc/mkcert.sh /usr/libexec/dovecot/ || die # remove unwanted docs rm -rf ${BINDIR}/usr/share/doc/dovecot || die minstalldocs AUTHORS ChangeLog COPYING* NEWS README TODO || die minstalldocs dovecot-example.conf || die } preinstall() { # adding proftpd user ${MLIBDIR}/mgroupadd -o "-g 97" dovecot ${MLIBDIR}/museradd -o "-u 97 -g dovecot -d /dev/null -s /bin/false" dovecot } postinstall() { # generate a self-signed ssl-cert if [[ ! -f /etc/dovecot/ssl/dovecot.pem ]] then SSLDIR=/etc/dovecot/ssl \ OPENSSLCONFIG=/etc/dovecot/ssl/dovecot-openssl.cnf \ /usr/libexec/dovecot/mkcert.sh &> /dev/null fi # rebuild ssl-parametes if [[ ! -f /var/run/dovecot/login/ssl-parameters.dat ]] then dovecot --build-ssl-parameters &> /dev/null fi mstartservice dovecot } postremove() { mstopservice dovecot }