diff options
author | sergei <sergei@FreeBSD.org> | 2003-12-08 16:08:14 +0000 |
---|---|---|
committer | sergei <sergei@FreeBSD.org> | 2003-12-08 16:08:14 +0000 |
commit | 1af9d39a030a61519820657e0f693e8d4f79f6e1 (patch) | |
tree | 680949508b272a92b7318d565af61f525489de7f /mail/dovecot | |
parent | 4ce5391e2b1dea9717ec6106929dbda83a04fadb (diff) | |
download | FreeBSD-ports-1af9d39a030a61519820657e0f693e8d4f79f6e1.zip FreeBSD-ports-1af9d39a030a61519820657e0f693e8d4f79f6e1.tar.gz |
- Update to 0.99.10.4
- Improve pkg-install script (create /var/dovecot tree)
- Add pkg-deinstall to cleanup dovecot directories and remove
created uids at de-install; ask to stop dovecot
if it's still running
- Make pkg-message obey PREFIX/DOCSDIR
- Make use of USE_OPENLDAP, rename WITH_LDAP2 to more standard WITH_LDAP
- Remove 'Feature Autodetection'. If you want the port built with extra
dependencies, tell it: avoid bloat
- Update the rc.d script to work with relative addressing
(e.g. './dovecot.sh start' works.)
- Assign maintainership to the submitter
PR: 59762
Submitted by: Robin Breathe <robin@isometry.net>
Diffstat (limited to 'mail/dovecot')
-rw-r--r-- | mail/dovecot/Makefile | 112 | ||||
-rw-r--r-- | mail/dovecot/distinfo | 2 | ||||
-rw-r--r-- | mail/dovecot/files/dovecot.sh.sample | 2 | ||||
-rw-r--r-- | mail/dovecot/pkg-deinstall | 55 | ||||
-rw-r--r-- | mail/dovecot/pkg-install | 122 | ||||
-rw-r--r-- | mail/dovecot/pkg-message | 5 | ||||
-rw-r--r-- | mail/dovecot/pkg-plist | 20 |
7 files changed, 166 insertions, 152 deletions
diff --git a/mail/dovecot/Makefile b/mail/dovecot/Makefile index 24521d8..995f4aa 100644 --- a/mail/dovecot/Makefile +++ b/mail/dovecot/Makefile @@ -6,11 +6,11 @@ # PORTNAME= dovecot -PORTVERSION= 0.99.10.2 +PORTVERSION= 0.99.10.4 CATEGORIES= mail ipv6 MASTER_SITES= http://dovecot.procontrol.fi/ -MAINTAINER= ports@FreeBSD.org +MAINTAINER= robin@isometry.net COMMENT= Secure and compact IMAP and POP3 servers LIB_DEPENDS= iconv.3:${PORTSDIR}/converters/libiconv @@ -25,84 +25,62 @@ CONFIGURE_ARGS= --without-shadow --enable-ipv6 \ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib" -.include <bsd.port.pre.mk> +PKGMESSAGE= ${WRKDIR}/pkg-message -# -# Feature Autodetection -# -.if exists(${LOCALBASE}/lib/libsasl.so.2) -WITH_SASL2= yes -.endif +DOCS= auth.txt configuration.txt design.txt \ + index.txt mail-storages.txt mkcert.sh multiaccess.txt \ + nfs.txt dovecot-ldap.conf dovecot-pgsql.conf \ + dovecot-openssl.cnf securecoding.txt -.if exists(${LOCALBASE}/vpopmail/bin/vckpw) -WITH_VPOPMAIL= yes -.endif +#.include <bsd.port.pre.mk> -.if exists(${LOCALBASE}/lib/libldap.so.2) -WITH_LDAP2= yes -.endif - -.if exists(${LOCALBASE}/lib/libpq.so.3) -WITH_PGSQL= yes -.endif - -# -# SASL2 support +## SASL2 support -> WITH_SASL2=1 # # SASL provides authentication support to # session-based protocols. This is can be # used by dovecot for authentication sources. # -.if WITH_SASL2 +.if defined(WITH_SASL2) LIB_DEPENDS+= sasl2.2:${PORTSDIR}/security/cyrus-sasl2 CONFIGURE_ARGS+= --with-cyrus-sasl2 .endif -# -# VPopMail Support +## VPopMail Support -> WITH_VPOPMAIL=1 # # vpopmail provides easy authentication and # multi-domain features. It was originally # created for use with Qmail. # -.if WITH_VPOPMAIL +.if defined(WITH_VPOPMAIL) VPOPMAIL= ${LOCALBASE}/vpopmail/bin/vchkpw BUILD_DEPENDS+= ${VPOPMAIL}:${PORTSDIR}/mail/vpopmail CONFIGURE_ARGS+= --with-vpopmail .endif -# -# OpenLDAP Support +## OpenLDAP Support -> WITH_LDAP=1 # # LDAP is the light-weight directory access # protocol and can be used by Dovecot for its # user database. # -.if WITH_LDAP2 -LIB_DEPENDS+= ldap.2:${PORTSDIR}/net/openldap21-client +.if defined(WITH_LDAP) +USE_OPENLDAP= yes CONFIGURE_ARGS+= --with-ldap .endif +## PostgreSQL Support -> WITH_PGSQL=1 # -# PostgreSQL Support -# -# PostgreSQL is a powerful SQL database which +# PostgreSQL is a powerful SQL database that # can be used to store user tables. # -.if WITH_PGSQL +.if defined(WITH_PGSQL) LIB_DEPENDS+= pq.3:${PORTSDIR}/databases/postgresql7 CONFIGURE_ARGS+= --with-pgsql .endif pre-everything:: - @${ECHO_MSG} "==> Dovecot Options" - @${ECHO_MSG} "==> See the Makefile for descriptions." - @${ECHO_MSG} "==> ------------------------------------------" - @${ECHO_MSG} "==> o SASL2 Support + WITH_SASL2" - @${ECHO_MSG} "==> o VPoPMail Support + WITH_VPOPMAIL" - @${ECHO_MSG} "==> o OpenLDAP2 Support + WITH_LDAP2" - @${ECHO_MSG} "==> o PostgreSQL Support + WITH_PGSQL" - @${ECHO_MSG} "==> ------------------------------------------" + @${ECHO_MSG} "==> Dovecot options: see ${MAKEFILE} for descriptions" + @${SED} -ne 's,^##,==> ,p' ${MAKEFILE} pre-build: @${REINPLACE_CMD} -e 's,%%SSLDIR%%,/var/dovecot/ssl,' \ @@ -111,11 +89,9 @@ pre-build: @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' \ ${WRKSRC}/dovecot-example.conf -pre-install: - @${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" \ - ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL - do-install: + @${SETENV} ${SCRIPTS_ENV} \ + ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL @${MKDIR} ${PREFIX}/libexec/dovecot ${INSTALL_PROGRAM} \ ${WRKSRC}/src/imap/imap \ @@ -126,41 +102,21 @@ do-install: ${PREFIX}/libexec/dovecot/ ${INSTALL_DATA} ${WRKSRC}/dovecot-example.conf ${PREFIX}/etc/ ${INSTALL_PROGRAM} ${WRKSRC}/src/master/dovecot ${PREFIX}/sbin/ - -post-install: - @${MKDIR} /var/dovecot - @${MKDIR} /var/dovecot/ssl - @${MKDIR} /var/dovecot/ssl/certs - @${MKDIR} /var/dovecot/ssl/private - @${MKDIR} /var/dovecot/auth - @${CHOWN} -R dovecot:dovecot /var/dovecot - @${MKDIR} /var/dovecot/login - @${CHOWN} root:dovecot /var/dovecot/login - @${MKDIR} /var/run/dovecot - @${CHMOD} 0700 /var/run/dovecot - @${CHOWN} root:dovecot /var/run/dovecot + @${SETENV} ${SCRIPTS_ENV} \ + ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/dovecot.sh.sample \ ${PREFIX}/etc/rc.d/dovecot.sh.sample .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} - @${INSTALL_DATA} \ - ${WRKSRC}/doc/auth.txt \ - ${WRKSRC}/doc/design.txt \ - ${WRKSRC}/doc/index.txt \ - ${WRKSRC}/doc/multiaccess.txt \ - ${WRKSRC}/doc/nfs.txt \ - ${WRKSRC}/doc/configuration.txt \ - ${WRKSRC}/doc/mail-storages.txt \ - ${WRKSRC}/doc/dovecot-ldap.conf \ - ${WRKSRC}/doc/dovecot-pgsql.conf \ - ${WRKSRC}/doc/dovecot-openssl.cnf \ - ${WRKSRC}/doc/mkcert.sh \ - ${FILESDIR}/README.FreeBSD \ - ${DOCSDIR} +.for document in ${DOCS} + @${INSTALL_DATA} ${WRKSRC}/doc/${document} ${DOCSDIR} +.endfor + @${INSTALL_DATA} ${FILESDIR}/README.FreeBSD ${DOCSDIR} .endif - @${CP} ${PKGMESSAGE} ${WRKDIR}/pkg-message - @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \ - ${WRKDIR}/pkg-message - @${CAT} ${WRKDIR}/pkg-message + @${SED} -e 's,%%PREFIX%%,${PREFIX},g' \ + -e 's,%%DOCSDIR%%,${DOCSDIR},g' \ + ${.CURDIR}/pkg-message >${PKGMESSAGE} + @${CAT} ${PKGMESSAGE} -.include <bsd.port.post.mk> +#.include <bsd.port.post.mk> +.include <bsd.port.mk> diff --git a/mail/dovecot/distinfo b/mail/dovecot/distinfo index 3ee7397..52c148d 100644 --- a/mail/dovecot/distinfo +++ b/mail/dovecot/distinfo @@ -1 +1 @@ -MD5 (dovecot-0.99.10.2.tar.gz) = d7a8783faea2654dcbb3770be9e4922d +MD5 (dovecot-0.99.10.4.tar.gz) = 81eda7985e99d28acd6d286aa0e13e07 diff --git a/mail/dovecot/files/dovecot.sh.sample b/mail/dovecot/files/dovecot.sh.sample index 625021f..e7c235c 100644 --- a/mail/dovecot/files/dovecot.sh.sample +++ b/mail/dovecot/files/dovecot.sh.sample @@ -1,6 +1,6 @@ #!/bin/sh -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then +if ! PREFIX=$(expr $(realpath $(dirname $0)) : "\(.*\)/etc/rc\.d\$"); then echo "$0: Cannot determine the PREFIX" >&2 exit 1 fi diff --git a/mail/dovecot/pkg-deinstall b/mail/dovecot/pkg-deinstall new file mode 100644 index 0000000..4f9c3a0 --- /dev/null +++ b/mail/dovecot/pkg-deinstall @@ -0,0 +1,55 @@ +#! /bin/sh + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then + read -p "${question} [${default}]? " answer + fi + echo ${answer:-${default}} +} + +yesno() { + local question default answer + + question=$1 + default=$2 + while :; do + answer=$(ask "${question}" "${default}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +delete_account() { + local u + + u=$1 + if yesno "Do you want me to remove user \"${u}\"" n; then + pw userdel -n ${u} + echo "Done." + fi +} + +case $2 in + +DEINSTALL) + if ps -axc | grep -qw dovecot; then + if yesno "Dovecot is still running. Shall I stop it?" y; then + killall dovecot + sleep 2 + else + echo "OK ... I hope you know what you are doing." + fi + fi + + delete_account dovecot + delete_account dovecot-auth + ;; + +esac diff --git a/mail/dovecot/pkg-install b/mail/dovecot/pkg-install index dbb6899..1cde7df 100644 --- a/mail/dovecot/pkg-install +++ b/mail/dovecot/pkg-install @@ -3,21 +3,17 @@ # $FreeBSD$ # -PKG_PREFIX=${PKG_PREFIX:=/usr/local} -BATCH=${BATCH:=no} +base=/var/dovecot ask() { local question default answer question=$1 default=$2 - if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then - read -p "${question} [${default}]? " answer + if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then + read -p "${question} [${default}]? " answer fi - if [ x${answer} = x ]; then - answer=${default} - fi - echo ${answer} + echo ${answer:-${default}} } yesno() { @@ -26,75 +22,73 @@ yesno() { question=$1 default=$2 while :; do - answer=$(ask "${question}" "${default}") - case "${answer}" in - [Yy]*) return 0;; - [Nn]*) return 1;; - esac - echo "Please answer yes or no." + answer=$(ask "${question}" "${default}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." done } -if [ x"$2" = xPRE-INSTALL ]; then - USER=dovecot - GROUP=dovecot +make_account() { + local u g gcos - if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if /usr/sbin/pw groupadd ${GROUP} -h - - then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi + u=$1 + g=$2 + gcos=$3 - if /usr/sbin/pw usershow "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." + if pw group show "${g}" >/dev/null 2>&1; then + echo "You already have a group \"${g}\", so I will use it." else - if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \ - -s /sbin/nologin \ - -c "Dovecot" + echo "You need a group \"${g}\"." + if which -s pw && yesno "Would you like me to create it" y then - echo "Added user \"${USER}\"." + pw groupadd ${g} || exit + echo "Done." else - echo "Adding user \"${USER}\" failed..." - echo "Please create it, and try again." - exit 1 - fi - fi - - USER=dovecot-auth - GROUP=dovecot-auth - - if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if /usr/sbin/pw groupadd ${GROUP} -h - - then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." echo "Please create it, and try again." exit 1 - fi + fi fi - - if /usr/sbin/pw usershow "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." + + if pw user show "${u}" >/dev/null 2>&1; then + echo "You already have a user \"${u}\", so I will use it." else - if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \ - -s /sbin/nologin \ - -c "Dovecot Auth" - then - echo "Added user \"${USER}\"." + echo "You need a user \"${u}\"." + if which -s pw && yesno "Would you like me to create it" y + then + pw useradd ${u} -g ${g} -h - -s /sbin/nologin -c "${gcos}" || exit + echo "Done." else - echo "Adding user \"${USER}\" failed..." echo "Please create it, and try again." exit 1 - fi + fi fi -fi +} + +case $2 in + +PRE-INSTALL) + make_account dovecot dovecot "Dovecot" + make_account dovecot-auth dovecot-auth "Dovecot Auth" + ;; + +POST-INSTALL) + DIRLIST="${base} ${base}/auth ${base}/ssl ${base}/ssl/certs \ + ${base}/ssl/private ${base}/login /var/run/dovecot" + echo "Fixing ownerships and modes in \"${base}\"." + for directory in ${DIRLIST}; do + if [ ! -d "${directory}" ]; then + mkdir -p ${directory} + echo "Created directory: ${directory}" + fi + done + chown -R root:wheel ${base} + chown -R dovecot:dovecot ${base}/auth ${base}/ssl + chown root:dovecot ${base}/login /var/run/dovecot + chmod 0750 ${base}/login + chmod 0700 /var/run/dovecot + ;; + +esac diff --git a/mail/dovecot/pkg-message b/mail/dovecot/pkg-message index 682a74c..2acffc9 100644 --- a/mail/dovecot/pkg-message +++ b/mail/dovecot/pkg-message @@ -13,10 +13,11 @@ Further information on configuration can be found in: - %%PREFIX%%/share/doc/dovecot/ + %%DOCSDIR%% FreeBSD specific information is covered in the following file: - %%PREFIX%%/share/doc/dovecot/README.FreeBSD + %%DOCSDIR%%/README.FreeBSD --------------------------------------------------------------------- + diff --git a/mail/dovecot/pkg-plist b/mail/dovecot/pkg-plist index 20c170e..d049485 100644 --- a/mail/dovecot/pkg-plist +++ b/mail/dovecot/pkg-plist @@ -1,22 +1,30 @@ etc/dovecot-example.conf etc/rc.d/dovecot.sh.sample +libexec/dovecot/dovecot-auth libexec/dovecot/imap libexec/dovecot/imap-login libexec/dovecot/pop3 libexec/dovecot/pop3-login -libexec/dovecot/dovecot-auth +@dirrm libexec/dovecot sbin/dovecot %%PORTDOCS%%%%DOCSDIR%%/auth.txt +%%PORTDOCS%%%%DOCSDIR%%/configuration.txt %%PORTDOCS%%%%DOCSDIR%%/design.txt -%%PORTDOCS%%%%DOCSDIR%%/nfs.txt %%PORTDOCS%%%%DOCSDIR%%/index.txt -%%PORTDOCS%%%%DOCSDIR%%/multiaccess.txt -%%PORTDOCS%%%%DOCSDIR%%/configuration.txt %%PORTDOCS%%%%DOCSDIR%%/mail-storages.txt +%%PORTDOCS%%%%DOCSDIR%%/mkcert.sh +%%PORTDOCS%%%%DOCSDIR%%/multiaccess.txt +%%PORTDOCS%%%%DOCSDIR%%/nfs.txt %%PORTDOCS%%%%DOCSDIR%%/dovecot-ldap.conf %%PORTDOCS%%%%DOCSDIR%%/dovecot-pgsql.conf %%PORTDOCS%%%%DOCSDIR%%/dovecot-openssl.cnf -%%PORTDOCS%%%%DOCSDIR%%/mkcert.sh +%%PORTDOCS%%%%DOCSDIR%%/securecoding.txt %%PORTDOCS%%%%DOCSDIR%%/README.FreeBSD %%PORTDOCS%%@dirrm %%DOCSDIR%% -@dirrm libexec/dovecot +@unexec rmdir /var/dovecot/auth 2>/dev/null || true +@unexec rmdir /var/dovecot/login 2>/dev/null || true +@unexec rmdir /var/dovecot/ssl/certs 2>/dev/null || true +@unexec rmdir /var/dovecot/ssl/private 2>/dev/null || true +@unexec rmdir /var/dovecot/ssl 2>/dev/null || true +@unexec rmdir /var/dovecot 2>/dev/null || true +@unexec rmdir /var/run/dovecot 2>/dev/null || true |