Bug 59762 - Update port: mail/dovecot to 0.9.10.4
Summary: Update port: mail/dovecot to 0.9.10.4
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Sergei Kolobov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-28 15:40 UTC by Robin Breathe
Modified: 2003-12-08 16:09 UTC (History)
0 users

See Also:


Attachments
dovecot-0.9.10.4.patch (465 bytes, patch)
2003-11-28 15:40 UTC, Robin Breathe
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Breathe 2003-11-28 15:40:08 UTC
Update to version 0.99.10.4:
- SUBSCRIBE broke subscription lists
- LIST code rewritten, children flags should be correct now
- SORT and THREAD could have given invalid replies
- Partial BODY[...] fetches might have returned wrong data or at least performed worse than necessary
- Fixed reference counters in imap-login and pop3-login. IMAP AUTHENTICATE and POP3 AUTH commands could have left the process stuck doing nothing forever.
Comment 1 Sergei Kolobov freebsd_committer 2003-11-28 16:09:41 UTC
State Changed
From-To: open->analyzed

I have tested the update. 


Comment 2 Sergei Kolobov freebsd_committer 2003-11-28 16:09:41 UTC
Responsible Changed
From-To: freebsd-ports-bugs->sergei

I'll commit it after the freeze.
Comment 3 Sergei Kolobov freebsd_committer 2003-11-28 16:14:40 UTC
Robin,

This port is currently orphaned. Are you interested in maintaining it?

Sergei
Comment 4 Robin Breathe 2003-11-28 16:21:19 UTC
Sergei Kolobov wrote:
> This port is currently orphaned. Are you interested in maintaining it?

I'd certainly be interested. Do I need to do anything other than 
continue to submit PRs?

- Robin
Comment 5 Sergei Kolobov freebsd_committer 2003-11-28 16:30:48 UTC
On 2003-11-28 at 16:21 +0000, Robin Breathe wrote:
> Sergei Kolobov wrote:
> >This port is currently orphaned. Are you interested in maintaining it?
> 
> I'd certainly be interested. 

Great, thanks! I will reassign maintainership to you as soon the port
freeze is over.

> Do I need to do anything other than continue to submit PRs?

Just try to keep it up-to-date with the latest versions, and fix any
problem if they come up. You may want to check FreeBSD Porter's Handbook
if you haven't done already.

Please let me know if you have any questions.

Sergei
Comment 6 Robin Breathe 2003-11-28 16:37:01 UTC
Sergei Kolobov wrote:
> I will reassign maintainership to you as soon the port
> freeze is over.

Perfect.

> Just try to keep it up-to-date with the latest versions, and fix any
> problem if they come up. You may want to check FreeBSD Porter's Handbook
> if you haven't done already.

I'll make it bedtime reading =) (only skimmed in the past).

- Robin
Comment 7 Robin Breathe 2003-11-29 18:08:58 UTC
As I'm provisionally taking maintainership of the port, I've put some 
more time into the patch.

Changes:

  - The old package was a little broken: it did not create the
    /var/dovecot tree or clean-up after itself. It also unconditionally
    created the required userids, but never offered to remove them.
    Now we create these directories in pkg-install and remove them with
    @unexec rmdir; users are created interactively (unless
    PACKAGE_BUILDING or BATCH is set) in pkg-install, and removed in
    pkg-deinstall.

  - Make pkg-message obey PREFIX/DOCSDIR (files/pkg-message.in).
    The old pkg-message needs to be deleted.

  - Make use of USE_OPENLDAP.
    Rename 'WITH_LDAP2' to more standard 'WITH_LDAP'.

  - Make use of PORTDOCS, clean-up pkg-plist.

  - Remove 'Feature Autodetection'. If you want the port built with extra
    dependencies, tell it: avoid bloat.

  - Remove the announcement from pre-everything::, since this is
    meaningless in a package install.

  - Update the rc.d script to work with relative addressing
    (e.g. './dovecot.sh start' works.)

  - Ask to stop dovecot if it's still running on deinstall.

Here's the updated patch:

diff -ruN /usr/ports/mail/dovecot/Makefile dovecot/Makefile
--- /usr/ports/mail/dovecot/Makefile	Sun Nov 16 14:48:57 2003
+++ dovecot/Makefile	Sat Nov 29 17:40:56 2003
@@ -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
@@ -24,36 +24,22 @@
  		--with-pam
  CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
  		LDFLAGS="-L${LOCALBASE}/lib"
+PKGMESSAGE=	${WRKDIR}/pkg-message
+PORTDOCS=	README.FreeBSD 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

  .include <bsd.port.pre.mk>

  #
-# Feature Autodetection
-#
-.if exists(${LOCALBASE}/lib/libsasl.so.2)
-WITH_SASL2=	yes
-.endif
-
-.if exists(${LOCALBASE}/vpopmail/bin/vckpw)
-WITH_VPOPMAIL=	yes
-.endif
-
-.if exists(${LOCALBASE}/lib/libldap.so.2)
-WITH_LDAP2=	yes
-.endif
-
-.if exists(${LOCALBASE}/lib/libpq.so.3)
-WITH_PGSQL=	yes
-.endif
-
-#
  # SASL2 support
  #
  # 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
@@ -65,7 +51,7 @@
  # 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
@@ -78,32 +64,22 @@
  # 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
  #
-# 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} "==> ------------------------------------------"
-
  pre-build:
  	@${REINPLACE_CMD} -e 's,%%SSLDIR%%,/var/dovecot/ssl,' \
  		${WRKSRC}/doc/mkcert.sh \
@@ -112,7 +88,7 @@
  		${WRKSRC}/dovecot-example.conf

  pre-install:
-	@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" \
+	@${SETENV} ${SCRIPTS_ENV} \
  		${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL

  do-install:
@@ -128,39 +104,21 @@
  	${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}
-.endif
-	@${CP} ${PKGMESSAGE} ${WRKDIR}/pkg-message
-	@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \
-		${WRKDIR}/pkg-message
-	@${CAT} ${WRKDIR}/pkg-message
+.for document in ${PORTDOCS:NREADME.FreeBSD}
+	@${INSTALL_MAN} ${WRKSRC}/doc/${document} ${DOCSDIR}
+.endfor
+	@${INSTALL_MAN} ${FILESDIR}/README.FreeBSD ${DOCSDIR}
+.endif
+	@${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
+		-e 's,%%DOCSDIR%%,${DOCSDIR},g' \
+		${FILESDIR}/pkg-message.in \
+		>${PKGMESSAGE}
+	@${CAT} ${PKGMESSAGE}

  .include <bsd.port.post.mk>
diff -ruN /usr/ports/mail/dovecot/distinfo dovecot/distinfo
--- /usr/ports/mail/dovecot/distinfo	Sun Nov 16 14:48:57 2003
+++ dovecot/distinfo	Fri Nov 28 23:30:18 2003
@@ -1 +1 @@
-MD5 (dovecot-0.99.10.2.tar.gz) = d7a8783faea2654dcbb3770be9e4922d
+MD5 (dovecot-0.99.10.4.tar.gz) = 81eda7985e99d28acd6d286aa0e13e07
diff -ruN /usr/ports/mail/dovecot/files/dovecot.sh.sample 
dovecot/files/dovecot.sh.sample
--- /usr/ports/mail/dovecot/files/dovecot.sh.sample	Sat May  3 21:50:26 2003
+++ dovecot/files/dovecot.sh.sample	Sat Nov 29 00:16:31 2003
@@ -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 -ruN /usr/ports/mail/dovecot/files/pkg-message.in 
dovecot/files/pkg-message.in
--- /usr/ports/mail/dovecot/files/pkg-message.in	Thu Jan  1 00:00:00 1970
+++ dovecot/files/pkg-message.in	Fri Nov 28 23:11:15 2003
@@ -0,0 +1,22 @@
+---------------------------------------------------------------------
+
+ You can get default configured IMAP and POP3 services running by
+ copying the following sample files to the given locations. In this
+ simple configuration Dovecot will authenticate users against the
+ systems passwd file and use the default /var/mail/$USER mbox files.
+
+  %%PREFIX%%/etc/dovecot-example.conf
+   -> %%PREFIX%%/etc/dovecot.conf
+
+  %%PREFIX%%/etc/rc.d/dovecot.sh.sample
+   -> %%PREFIX%%/etc/rc.d/dovecot.sh
+
+ Further information on configuration can be found in:
+
+  %%DOCSDIR%%
+
+ FreeBSD specific information is covered in the following file:
+
+  %%DOCSDIR%%/README.FreeBSD
+
+---------------------------------------------------------------------
diff -ruN /usr/ports/mail/dovecot/pkg-deinstall dovecot/pkg-deinstall
--- /usr/ports/mail/dovecot/pkg-deinstall	Thu Jan  1 00:00:00 1970
+++ dovecot/pkg-deinstall	Sat Nov 29 17:57:59 2003
@@ -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 -ruN /usr/ports/mail/dovecot/pkg-install dovecot/pkg-install
--- /usr/ports/mail/dovecot/pkg-install	Mon Jun 30 14:06:34 2003
+++ dovecot/pkg-install	Sat Nov 29 18:02:28 2003
@@ -3,21 +3,17 @@
  #	$FreeBSD: ports/mail/dovecot/pkg-install,v 1.2 2003/05/03 21:50:26 
nork Exp $
  #

-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 @@
      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
-
-    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
-
-    if /usr/sbin/pw usershow "${USER}" 2>/dev/null; then
-        echo "You already have a user \"${USER}\", so I will use it."
-    else
-        if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \
-           -s /sbin/nologin \
-           -c "Dovecot"
-	then
-	    echo "Added user \"${USER}\"."
-	else
-	    echo "Adding user \"${USER}\" failed..."
-            echo "Please create it, and try again."
-            exit 1
-        fi
-    fi
+make_account() {
+    local u g gcos

-    USER=dovecot-auth
-    GROUP=dovecot-auth
+    u=$1
+    g=$2
+    gcos=$3

-    if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then
-	echo "You already have a group \"${GROUP}\", 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 groupadd ${GROUP} -h -
+	echo "You need a group \"${g}\"."
+	if which -s pw && yesno "Would you like me to create it" y
  	then
-	    echo "Added group \"${GROUP}\"."
+	    pw groupadd ${g} || exit
+	    echo "Done."
  	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 -ruN /usr/ports/mail/dovecot/pkg-plist dovecot/pkg-plist
--- /usr/ports/mail/dovecot/pkg-plist	Sun Nov 16 14:48:57 2003
+++ dovecot/pkg-plist	Sat Nov 29 15:15:00 2003
@@ -1,22 +1,16 @@
  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
  sbin/dovecot
-%%PORTDOCS%%%%DOCSDIR%%/auth.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%%/dovecot-ldap.conf
-%%PORTDOCS%%%%DOCSDIR%%/dovecot-pgsql.conf
-%%PORTDOCS%%%%DOCSDIR%%/dovecot-openssl.cnf
-%%PORTDOCS%%%%DOCSDIR%%/mkcert.sh
-%%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
Comment 8 Sergei Kolobov freebsd_committer 2003-12-05 13:18:14 UTC
State Changed
From-To: analyzed->feedback

The patch does not apply cleanly. 
Asked submitter for updated patch to sent to me directly.
Comment 9 Sergei Kolobov freebsd_committer 2003-12-08 16:08:40 UTC
State Changed
From-To: feedback->closed

Committed, thanks! 

You are the new mail/dovecot port maintainer.