- 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>
This commit is contained in:
Sergei Kolobov 2003-12-08 16:08:14 +00:00
parent e0780cbf64
commit a2d84b3811
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=95382
14 changed files with 336 additions and 308 deletions

View file

@ -6,11 +6,11 @@
# #
PORTNAME= dovecot PORTNAME= dovecot
PORTVERSION= 0.99.10.2 PORTVERSION= 0.99.10.4
CATEGORIES= mail ipv6 CATEGORIES= mail ipv6
MASTER_SITES= http://dovecot.procontrol.fi/ MASTER_SITES= http://dovecot.procontrol.fi/
MAINTAINER= ports@FreeBSD.org MAINTAINER= robin@isometry.net
COMMENT= Secure and compact IMAP and POP3 servers COMMENT= Secure and compact IMAP and POP3 servers
LIB_DEPENDS= iconv.3:${PORTSDIR}/converters/libiconv LIB_DEPENDS= iconv.3:${PORTSDIR}/converters/libiconv
@ -25,84 +25,62 @@ CONFIGURE_ARGS= --without-shadow --enable-ipv6 \
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib" LDFLAGS="-L${LOCALBASE}/lib"
.include <bsd.port.pre.mk> PKGMESSAGE= ${WRKDIR}/pkg-message
# DOCS= auth.txt configuration.txt design.txt \
# Feature Autodetection index.txt mail-storages.txt mkcert.sh multiaccess.txt \
# nfs.txt dovecot-ldap.conf dovecot-pgsql.conf \
.if exists(${LOCALBASE}/lib/libsasl.so.2) dovecot-openssl.cnf securecoding.txt
WITH_SASL2= yes
.endif
.if exists(${LOCALBASE}/vpopmail/bin/vckpw) #.include <bsd.port.pre.mk>
WITH_VPOPMAIL= yes
.endif
.if exists(${LOCALBASE}/lib/libldap.so.2) ## SASL2 support -> WITH_SASL2=1
WITH_LDAP2= yes
.endif
.if exists(${LOCALBASE}/lib/libpq.so.3)
WITH_PGSQL= yes
.endif
#
# SASL2 support
# #
# SASL provides authentication support to # SASL provides authentication support to
# session-based protocols. This is can be # session-based protocols. This is can be
# used by dovecot for authentication sources. # used by dovecot for authentication sources.
# #
.if WITH_SASL2 .if defined(WITH_SASL2)
LIB_DEPENDS+= sasl2.2:${PORTSDIR}/security/cyrus-sasl2 LIB_DEPENDS+= sasl2.2:${PORTSDIR}/security/cyrus-sasl2
CONFIGURE_ARGS+= --with-cyrus-sasl2 CONFIGURE_ARGS+= --with-cyrus-sasl2
.endif .endif
# ## VPopMail Support -> WITH_VPOPMAIL=1
# VPopMail Support
# #
# vpopmail provides easy authentication and # vpopmail provides easy authentication and
# multi-domain features. It was originally # multi-domain features. It was originally
# created for use with Qmail. # created for use with Qmail.
# #
.if WITH_VPOPMAIL .if defined(WITH_VPOPMAIL)
VPOPMAIL= ${LOCALBASE}/vpopmail/bin/vchkpw VPOPMAIL= ${LOCALBASE}/vpopmail/bin/vchkpw
BUILD_DEPENDS+= ${VPOPMAIL}:${PORTSDIR}/mail/vpopmail BUILD_DEPENDS+= ${VPOPMAIL}:${PORTSDIR}/mail/vpopmail
CONFIGURE_ARGS+= --with-vpopmail CONFIGURE_ARGS+= --with-vpopmail
.endif .endif
# ## OpenLDAP Support -> WITH_LDAP=1
# OpenLDAP Support
# #
# LDAP is the light-weight directory access # LDAP is the light-weight directory access
# protocol and can be used by Dovecot for its # protocol and can be used by Dovecot for its
# user database. # user database.
# #
.if WITH_LDAP2 .if defined(WITH_LDAP)
LIB_DEPENDS+= ldap.2:${PORTSDIR}/net/openldap21-client USE_OPENLDAP= yes
CONFIGURE_ARGS+= --with-ldap CONFIGURE_ARGS+= --with-ldap
.endif .endif
## PostgreSQL Support -> WITH_PGSQL=1
# #
# PostgreSQL Support # PostgreSQL is a powerful SQL database that
#
# PostgreSQL is a powerful SQL database which
# can be used to store user tables. # can be used to store user tables.
# #
.if WITH_PGSQL .if defined(WITH_PGSQL)
LIB_DEPENDS+= pq.3:${PORTSDIR}/databases/postgresql7 LIB_DEPENDS+= pq.3:${PORTSDIR}/databases/postgresql7
CONFIGURE_ARGS+= --with-pgsql CONFIGURE_ARGS+= --with-pgsql
.endif .endif
pre-everything:: pre-everything::
@${ECHO_MSG} "==> Dovecot Options" @${ECHO_MSG} "==> Dovecot options: see ${MAKEFILE} for descriptions"
@${ECHO_MSG} "==> See the Makefile for descriptions." @${SED} -ne 's,^##,==> ,p' ${MAKEFILE}
@${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: pre-build:
@${REINPLACE_CMD} -e 's,%%SSLDIR%%,/var/dovecot/ssl,' \ @${REINPLACE_CMD} -e 's,%%SSLDIR%%,/var/dovecot/ssl,' \
@ -111,11 +89,9 @@ pre-build:
@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' \ @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' \
${WRKSRC}/dovecot-example.conf ${WRKSRC}/dovecot-example.conf
pre-install:
@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" \
${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
do-install: do-install:
@${SETENV} ${SCRIPTS_ENV} \
${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
@${MKDIR} ${PREFIX}/libexec/dovecot @${MKDIR} ${PREFIX}/libexec/dovecot
${INSTALL_PROGRAM} \ ${INSTALL_PROGRAM} \
${WRKSRC}/src/imap/imap \ ${WRKSRC}/src/imap/imap \
@ -126,41 +102,21 @@ do-install:
${PREFIX}/libexec/dovecot/ ${PREFIX}/libexec/dovecot/
${INSTALL_DATA} ${WRKSRC}/dovecot-example.conf ${PREFIX}/etc/ ${INSTALL_DATA} ${WRKSRC}/dovecot-example.conf ${PREFIX}/etc/
${INSTALL_PROGRAM} ${WRKSRC}/src/master/dovecot ${PREFIX}/sbin/ ${INSTALL_PROGRAM} ${WRKSRC}/src/master/dovecot ${PREFIX}/sbin/
@${SETENV} ${SCRIPTS_ENV} \
post-install: ${SH} ${PKGINSTALL} ${PKGNAME} 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
${INSTALL_SCRIPT} -m 751 ${FILESDIR}/dovecot.sh.sample \ ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/dovecot.sh.sample \
${PREFIX}/etc/rc.d/dovecot.sh.sample ${PREFIX}/etc/rc.d/dovecot.sh.sample
.if !defined(NOPORTDOCS) .if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR} @${MKDIR} ${DOCSDIR}
@${INSTALL_DATA} \ .for document in ${DOCS}
${WRKSRC}/doc/auth.txt \ @${INSTALL_DATA} ${WRKSRC}/doc/${document} ${DOCSDIR}
${WRKSRC}/doc/design.txt \ .endfor
${WRKSRC}/doc/index.txt \ @${INSTALL_DATA} ${FILESDIR}/README.FreeBSD ${DOCSDIR}
${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 .endif
@${CP} ${PKGMESSAGE} ${WRKDIR}/pkg-message @${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \ -e 's,%%DOCSDIR%%,${DOCSDIR},g' \
${WRKDIR}/pkg-message ${.CURDIR}/pkg-message >${PKGMESSAGE}
@${CAT} ${WRKDIR}/pkg-message @${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk> #.include <bsd.port.post.mk>
.include <bsd.port.mk>

View file

@ -1 +1 @@
MD5 (dovecot-0.99.10.2.tar.gz) = d7a8783faea2654dcbb3770be9e4922d MD5 (dovecot-0.99.10.4.tar.gz) = 81eda7985e99d28acd6d286aa0e13e07

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/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 echo "$0: Cannot determine the PREFIX" >&2
exit 1 exit 1
fi fi

View file

@ -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

View file

@ -3,21 +3,17 @@
# $FreeBSD$ # $FreeBSD$
# #
PKG_PREFIX=${PKG_PREFIX:=/usr/local} base=/var/dovecot
BATCH=${BATCH:=no}
ask() { ask() {
local question default answer local question default answer
question=$1 question=$1
default=$2 default=$2
if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
read -p "${question} [${default}]? " answer read -p "${question} [${default}]? " answer
fi fi
if [ x${answer} = x ]; then echo ${answer:-${default}}
answer=${default}
fi
echo ${answer}
} }
yesno() { yesno() {
@ -35,66 +31,64 @@ yesno() {
done done
} }
if [ x"$2" = xPRE-INSTALL ]; then make_account() {
USER=dovecot local u g gcos
GROUP=dovecot
if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then u=$1
echo "You already have a group \"${GROUP}\", so I will use it." g=$2
gcos=$3
if pw group show "${g}" >/dev/null 2>&1; then
echo "You already have a group \"${g}\", so I will use it."
else 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 then
echo "Added group \"${GROUP}\"." pw groupadd ${g} || exit
echo "Done."
else else
echo "Adding group \"${GROUP}\" failed..."
echo "Please create it, and try again." echo "Please create it, and try again."
exit 1 exit 1
fi fi
fi fi
if /usr/sbin/pw usershow "${USER}" 2>/dev/null; then if pw user show "${u}" >/dev/null 2>&1; then
echo "You already have a user \"${USER}\", so I will use it." echo "You already have a user \"${u}\", so I will use it."
else else
if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \ echo "You need a user \"${u}\"."
-s /sbin/nologin \ if which -s pw && yesno "Would you like me to create it" y
-c "Dovecot"
then then
echo "Added user \"${USER}\"." pw useradd ${u} -g ${g} -h - -s /sbin/nologin -c "${gcos}" || exit
echo "Done."
else else
echo "Adding user \"${USER}\" failed..."
echo "Please create it, and try again." echo "Please create it, and try again."
exit 1 exit 1
fi fi
fi fi
}
USER=dovecot-auth case $2 in
GROUP=dovecot-auth
if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then PRE-INSTALL)
echo "You already have a group \"${GROUP}\", so I will use it." make_account dovecot dovecot "Dovecot"
else make_account dovecot-auth dovecot-auth "Dovecot Auth"
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 POST-INSTALL)
echo "You already have a user \"${USER}\", so I will use it." DIRLIST="${base} ${base}/auth ${base}/ssl ${base}/ssl/certs \
else ${base}/ssl/private ${base}/login /var/run/dovecot"
if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \ echo "Fixing ownerships and modes in \"${base}\"."
-s /sbin/nologin \ for directory in ${DIRLIST}; do
-c "Dovecot Auth" if [ ! -d "${directory}" ]; then
then mkdir -p ${directory}
echo "Added user \"${USER}\"." echo "Created directory: ${directory}"
else
echo "Adding user \"${USER}\" failed..."
echo "Please create it, and try again."
exit 1
fi
fi
fi 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

View file

@ -13,10 +13,11 @@
Further information on configuration can be found in: Further information on configuration can be found in:
%%PREFIX%%/share/doc/dovecot/ %%DOCSDIR%%
FreeBSD specific information is covered in the following file: FreeBSD specific information is covered in the following file:
%%PREFIX%%/share/doc/dovecot/README.FreeBSD %%DOCSDIR%%/README.FreeBSD
--------------------------------------------------------------------- ---------------------------------------------------------------------

View file

@ -1,22 +1,30 @@
etc/dovecot-example.conf etc/dovecot-example.conf
etc/rc.d/dovecot.sh.sample etc/rc.d/dovecot.sh.sample
libexec/dovecot/dovecot-auth
libexec/dovecot/imap libexec/dovecot/imap
libexec/dovecot/imap-login libexec/dovecot/imap-login
libexec/dovecot/pop3 libexec/dovecot/pop3
libexec/dovecot/pop3-login libexec/dovecot/pop3-login
libexec/dovecot/dovecot-auth @dirrm libexec/dovecot
sbin/dovecot sbin/dovecot
%%PORTDOCS%%%%DOCSDIR%%/auth.txt %%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%%/configuration.txt
%%PORTDOCS%%%%DOCSDIR%%/design.txt
%%PORTDOCS%%%%DOCSDIR%%/index.txt
%%PORTDOCS%%%%DOCSDIR%%/mail-storages.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-ldap.conf
%%PORTDOCS%%%%DOCSDIR%%/dovecot-pgsql.conf %%PORTDOCS%%%%DOCSDIR%%/dovecot-pgsql.conf
%%PORTDOCS%%%%DOCSDIR%%/dovecot-openssl.cnf %%PORTDOCS%%%%DOCSDIR%%/dovecot-openssl.cnf
%%PORTDOCS%%%%DOCSDIR%%/mkcert.sh %%PORTDOCS%%%%DOCSDIR%%/securecoding.txt
%%PORTDOCS%%%%DOCSDIR%%/README.FreeBSD %%PORTDOCS%%%%DOCSDIR%%/README.FreeBSD
%%PORTDOCS%%@dirrm %%DOCSDIR%% %%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

View file

@ -6,11 +6,11 @@
# #
PORTNAME= dovecot PORTNAME= dovecot
PORTVERSION= 0.99.10.2 PORTVERSION= 0.99.10.4
CATEGORIES= mail ipv6 CATEGORIES= mail ipv6
MASTER_SITES= http://dovecot.procontrol.fi/ MASTER_SITES= http://dovecot.procontrol.fi/
MAINTAINER= ports@FreeBSD.org MAINTAINER= robin@isometry.net
COMMENT= Secure and compact IMAP and POP3 servers COMMENT= Secure and compact IMAP and POP3 servers
LIB_DEPENDS= iconv.3:${PORTSDIR}/converters/libiconv LIB_DEPENDS= iconv.3:${PORTSDIR}/converters/libiconv
@ -25,84 +25,62 @@ CONFIGURE_ARGS= --without-shadow --enable-ipv6 \
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib" LDFLAGS="-L${LOCALBASE}/lib"
.include <bsd.port.pre.mk> PKGMESSAGE= ${WRKDIR}/pkg-message
# DOCS= auth.txt configuration.txt design.txt \
# Feature Autodetection index.txt mail-storages.txt mkcert.sh multiaccess.txt \
# nfs.txt dovecot-ldap.conf dovecot-pgsql.conf \
.if exists(${LOCALBASE}/lib/libsasl.so.2) dovecot-openssl.cnf securecoding.txt
WITH_SASL2= yes
.endif
.if exists(${LOCALBASE}/vpopmail/bin/vckpw) #.include <bsd.port.pre.mk>
WITH_VPOPMAIL= yes
.endif
.if exists(${LOCALBASE}/lib/libldap.so.2) ## SASL2 support -> WITH_SASL2=1
WITH_LDAP2= yes
.endif
.if exists(${LOCALBASE}/lib/libpq.so.3)
WITH_PGSQL= yes
.endif
#
# SASL2 support
# #
# SASL provides authentication support to # SASL provides authentication support to
# session-based protocols. This is can be # session-based protocols. This is can be
# used by dovecot for authentication sources. # used by dovecot for authentication sources.
# #
.if WITH_SASL2 .if defined(WITH_SASL2)
LIB_DEPENDS+= sasl2.2:${PORTSDIR}/security/cyrus-sasl2 LIB_DEPENDS+= sasl2.2:${PORTSDIR}/security/cyrus-sasl2
CONFIGURE_ARGS+= --with-cyrus-sasl2 CONFIGURE_ARGS+= --with-cyrus-sasl2
.endif .endif
# ## VPopMail Support -> WITH_VPOPMAIL=1
# VPopMail Support
# #
# vpopmail provides easy authentication and # vpopmail provides easy authentication and
# multi-domain features. It was originally # multi-domain features. It was originally
# created for use with Qmail. # created for use with Qmail.
# #
.if WITH_VPOPMAIL .if defined(WITH_VPOPMAIL)
VPOPMAIL= ${LOCALBASE}/vpopmail/bin/vchkpw VPOPMAIL= ${LOCALBASE}/vpopmail/bin/vchkpw
BUILD_DEPENDS+= ${VPOPMAIL}:${PORTSDIR}/mail/vpopmail BUILD_DEPENDS+= ${VPOPMAIL}:${PORTSDIR}/mail/vpopmail
CONFIGURE_ARGS+= --with-vpopmail CONFIGURE_ARGS+= --with-vpopmail
.endif .endif
# ## OpenLDAP Support -> WITH_LDAP=1
# OpenLDAP Support
# #
# LDAP is the light-weight directory access # LDAP is the light-weight directory access
# protocol and can be used by Dovecot for its # protocol and can be used by Dovecot for its
# user database. # user database.
# #
.if WITH_LDAP2 .if defined(WITH_LDAP)
LIB_DEPENDS+= ldap.2:${PORTSDIR}/net/openldap21-client USE_OPENLDAP= yes
CONFIGURE_ARGS+= --with-ldap CONFIGURE_ARGS+= --with-ldap
.endif .endif
## PostgreSQL Support -> WITH_PGSQL=1
# #
# PostgreSQL Support # PostgreSQL is a powerful SQL database that
#
# PostgreSQL is a powerful SQL database which
# can be used to store user tables. # can be used to store user tables.
# #
.if WITH_PGSQL .if defined(WITH_PGSQL)
LIB_DEPENDS+= pq.3:${PORTSDIR}/databases/postgresql7 LIB_DEPENDS+= pq.3:${PORTSDIR}/databases/postgresql7
CONFIGURE_ARGS+= --with-pgsql CONFIGURE_ARGS+= --with-pgsql
.endif .endif
pre-everything:: pre-everything::
@${ECHO_MSG} "==> Dovecot Options" @${ECHO_MSG} "==> Dovecot options: see ${MAKEFILE} for descriptions"
@${ECHO_MSG} "==> See the Makefile for descriptions." @${SED} -ne 's,^##,==> ,p' ${MAKEFILE}
@${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: pre-build:
@${REINPLACE_CMD} -e 's,%%SSLDIR%%,/var/dovecot/ssl,' \ @${REINPLACE_CMD} -e 's,%%SSLDIR%%,/var/dovecot/ssl,' \
@ -111,11 +89,9 @@ pre-build:
@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' \ @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' \
${WRKSRC}/dovecot-example.conf ${WRKSRC}/dovecot-example.conf
pre-install:
@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" \
${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
do-install: do-install:
@${SETENV} ${SCRIPTS_ENV} \
${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
@${MKDIR} ${PREFIX}/libexec/dovecot @${MKDIR} ${PREFIX}/libexec/dovecot
${INSTALL_PROGRAM} \ ${INSTALL_PROGRAM} \
${WRKSRC}/src/imap/imap \ ${WRKSRC}/src/imap/imap \
@ -126,41 +102,21 @@ do-install:
${PREFIX}/libexec/dovecot/ ${PREFIX}/libexec/dovecot/
${INSTALL_DATA} ${WRKSRC}/dovecot-example.conf ${PREFIX}/etc/ ${INSTALL_DATA} ${WRKSRC}/dovecot-example.conf ${PREFIX}/etc/
${INSTALL_PROGRAM} ${WRKSRC}/src/master/dovecot ${PREFIX}/sbin/ ${INSTALL_PROGRAM} ${WRKSRC}/src/master/dovecot ${PREFIX}/sbin/
@${SETENV} ${SCRIPTS_ENV} \
post-install: ${SH} ${PKGINSTALL} ${PKGNAME} 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
${INSTALL_SCRIPT} -m 751 ${FILESDIR}/dovecot.sh.sample \ ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/dovecot.sh.sample \
${PREFIX}/etc/rc.d/dovecot.sh.sample ${PREFIX}/etc/rc.d/dovecot.sh.sample
.if !defined(NOPORTDOCS) .if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR} @${MKDIR} ${DOCSDIR}
@${INSTALL_DATA} \ .for document in ${DOCS}
${WRKSRC}/doc/auth.txt \ @${INSTALL_DATA} ${WRKSRC}/doc/${document} ${DOCSDIR}
${WRKSRC}/doc/design.txt \ .endfor
${WRKSRC}/doc/index.txt \ @${INSTALL_DATA} ${FILESDIR}/README.FreeBSD ${DOCSDIR}
${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 .endif
@${CP} ${PKGMESSAGE} ${WRKDIR}/pkg-message @${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \ -e 's,%%DOCSDIR%%,${DOCSDIR},g' \
${WRKDIR}/pkg-message ${.CURDIR}/pkg-message >${PKGMESSAGE}
@${CAT} ${WRKDIR}/pkg-message @${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk> #.include <bsd.port.post.mk>
.include <bsd.port.mk>

View file

@ -1 +1 @@
MD5 (dovecot-0.99.10.2.tar.gz) = d7a8783faea2654dcbb3770be9e4922d MD5 (dovecot-0.99.10.4.tar.gz) = 81eda7985e99d28acd6d286aa0e13e07

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/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 echo "$0: Cannot determine the PREFIX" >&2
exit 1 exit 1
fi fi

View file

@ -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

View file

@ -3,21 +3,17 @@
# $FreeBSD$ # $FreeBSD$
# #
PKG_PREFIX=${PKG_PREFIX:=/usr/local} base=/var/dovecot
BATCH=${BATCH:=no}
ask() { ask() {
local question default answer local question default answer
question=$1 question=$1
default=$2 default=$2
if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
read -p "${question} [${default}]? " answer read -p "${question} [${default}]? " answer
fi fi
if [ x${answer} = x ]; then echo ${answer:-${default}}
answer=${default}
fi
echo ${answer}
} }
yesno() { yesno() {
@ -35,66 +31,64 @@ yesno() {
done done
} }
if [ x"$2" = xPRE-INSTALL ]; then make_account() {
USER=dovecot local u g gcos
GROUP=dovecot
if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then u=$1
echo "You already have a group \"${GROUP}\", so I will use it." g=$2
gcos=$3
if pw group show "${g}" >/dev/null 2>&1; then
echo "You already have a group \"${g}\", so I will use it."
else 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 then
echo "Added group \"${GROUP}\"." pw groupadd ${g} || exit
echo "Done."
else else
echo "Adding group \"${GROUP}\" failed..."
echo "Please create it, and try again." echo "Please create it, and try again."
exit 1 exit 1
fi fi
fi fi
if /usr/sbin/pw usershow "${USER}" 2>/dev/null; then if pw user show "${u}" >/dev/null 2>&1; then
echo "You already have a user \"${USER}\", so I will use it." echo "You already have a user \"${u}\", so I will use it."
else else
if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \ echo "You need a user \"${u}\"."
-s /sbin/nologin \ if which -s pw && yesno "Would you like me to create it" y
-c "Dovecot"
then then
echo "Added user \"${USER}\"." pw useradd ${u} -g ${g} -h - -s /sbin/nologin -c "${gcos}" || exit
echo "Done."
else else
echo "Adding user \"${USER}\" failed..."
echo "Please create it, and try again." echo "Please create it, and try again."
exit 1 exit 1
fi fi
fi fi
}
USER=dovecot-auth case $2 in
GROUP=dovecot-auth
if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then PRE-INSTALL)
echo "You already have a group \"${GROUP}\", so I will use it." make_account dovecot dovecot "Dovecot"
else make_account dovecot-auth dovecot-auth "Dovecot Auth"
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 POST-INSTALL)
echo "You already have a user \"${USER}\", so I will use it." DIRLIST="${base} ${base}/auth ${base}/ssl ${base}/ssl/certs \
else ${base}/ssl/private ${base}/login /var/run/dovecot"
if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \ echo "Fixing ownerships and modes in \"${base}\"."
-s /sbin/nologin \ for directory in ${DIRLIST}; do
-c "Dovecot Auth" if [ ! -d "${directory}" ]; then
then mkdir -p ${directory}
echo "Added user \"${USER}\"." echo "Created directory: ${directory}"
else
echo "Adding user \"${USER}\" failed..."
echo "Please create it, and try again."
exit 1
fi
fi
fi 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

View file

@ -13,10 +13,11 @@
Further information on configuration can be found in: Further information on configuration can be found in:
%%PREFIX%%/share/doc/dovecot/ %%DOCSDIR%%
FreeBSD specific information is covered in the following file: FreeBSD specific information is covered in the following file:
%%PREFIX%%/share/doc/dovecot/README.FreeBSD %%DOCSDIR%%/README.FreeBSD
--------------------------------------------------------------------- ---------------------------------------------------------------------

View file

@ -1,22 +1,30 @@
etc/dovecot-example.conf etc/dovecot-example.conf
etc/rc.d/dovecot.sh.sample etc/rc.d/dovecot.sh.sample
libexec/dovecot/dovecot-auth
libexec/dovecot/imap libexec/dovecot/imap
libexec/dovecot/imap-login libexec/dovecot/imap-login
libexec/dovecot/pop3 libexec/dovecot/pop3
libexec/dovecot/pop3-login libexec/dovecot/pop3-login
libexec/dovecot/dovecot-auth @dirrm libexec/dovecot
sbin/dovecot sbin/dovecot
%%PORTDOCS%%%%DOCSDIR%%/auth.txt %%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%%/configuration.txt
%%PORTDOCS%%%%DOCSDIR%%/design.txt
%%PORTDOCS%%%%DOCSDIR%%/index.txt
%%PORTDOCS%%%%DOCSDIR%%/mail-storages.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-ldap.conf
%%PORTDOCS%%%%DOCSDIR%%/dovecot-pgsql.conf %%PORTDOCS%%%%DOCSDIR%%/dovecot-pgsql.conf
%%PORTDOCS%%%%DOCSDIR%%/dovecot-openssl.cnf %%PORTDOCS%%%%DOCSDIR%%/dovecot-openssl.cnf
%%PORTDOCS%%%%DOCSDIR%%/mkcert.sh %%PORTDOCS%%%%DOCSDIR%%/securecoding.txt
%%PORTDOCS%%%%DOCSDIR%%/README.FreeBSD %%PORTDOCS%%%%DOCSDIR%%/README.FreeBSD
%%PORTDOCS%%@dirrm %%DOCSDIR%% %%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