aboutsummaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorSergei Kolobov <sergei@FreeBSD.org>2003-12-08 16:08:14 +0000
committerSergei Kolobov <sergei@FreeBSD.org>2003-12-08 16:08:14 +0000
commita2d84b38118a1c5a73fc4f676328f1e3f1a44f95 (patch)
tree5aae7889a124881cba32a067a220c54e5a8ca5b9 /mail
parente0780cbf64428d8e43abfe499b853e5b667525d4 (diff)
downloadports-a2d84b38118a1c5a73fc4f676328f1e3f1a44f95.tar.gz
ports-a2d84b38118a1c5a73fc4f676328f1e3f1a44f95.zip
Notes
Diffstat (limited to 'mail')
-rw-r--r--mail/dovecot-devel/Makefile112
-rw-r--r--mail/dovecot-devel/distinfo2
-rw-r--r--mail/dovecot-devel/files/dovecot.sh.sample2
-rw-r--r--mail/dovecot-devel/pkg-deinstall55
-rw-r--r--mail/dovecot-devel/pkg-install122
-rw-r--r--mail/dovecot-devel/pkg-message5
-rw-r--r--mail/dovecot-devel/pkg-plist20
-rw-r--r--mail/dovecot/Makefile112
-rw-r--r--mail/dovecot/distinfo2
-rw-r--r--mail/dovecot/files/dovecot.sh.sample2
-rw-r--r--mail/dovecot/pkg-deinstall55
-rw-r--r--mail/dovecot/pkg-install122
-rw-r--r--mail/dovecot/pkg-message5
-rw-r--r--mail/dovecot/pkg-plist20
14 files changed, 332 insertions, 304 deletions
diff --git a/mail/dovecot-devel/Makefile b/mail/dovecot-devel/Makefile
index 24521d844aae..995f4aaa0308 100644
--- a/mail/dovecot-devel/Makefile
+++ b/mail/dovecot-devel/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-devel/distinfo b/mail/dovecot-devel/distinfo
index 3ee73979a64e..52c148d2d6a0 100644
--- a/mail/dovecot-devel/distinfo
+++ b/mail/dovecot-devel/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-devel/files/dovecot.sh.sample b/mail/dovecot-devel/files/dovecot.sh.sample
index 625021fa6def..e7c235c8d43a 100644
--- a/mail/dovecot-devel/files/dovecot.sh.sample
+++ b/mail/dovecot-devel/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-devel/pkg-deinstall b/mail/dovecot-devel/pkg-deinstall
new file mode 100644
index 000000000000..4f9c3a063539
--- /dev/null
+++ b/mail/dovecot-devel/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-devel/pkg-install b/mail/dovecot-devel/pkg-install
index dbb68998b884..1cde7df41f58 100644
--- a/mail/dovecot-devel/pkg-install
+++ b/mail/dovecot-devel/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-devel/pkg-message b/mail/dovecot-devel/pkg-message
index 682a74cbcd56..2acffc98aadf 100644
--- a/mail/dovecot-devel/pkg-message
+++ b/mail/dovecot-devel/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-devel/pkg-plist b/mail/dovecot-devel/pkg-plist
index 20c170eca2dc..d0494856497f 100644
--- a/mail/dovecot-devel/pkg-plist
+++ b/mail/dovecot-devel/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
diff --git a/mail/dovecot/Makefile b/mail/dovecot/Makefile
index 24521d844aae..995f4aaa0308 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 3ee73979a64e..52c148d2d6a0 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 625021fa6def..e7c235c8d43a 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 000000000000..4f9c3a063539
--- /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 dbb68998b884..1cde7df41f58 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 682a74cbcd56..2acffc98aadf 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 20c170eca2dc..d0494856497f 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