svn commit: r398373 - in head/security/cyrus-sasl2: . files
Hajimu UMEMOTO
ume at FreeBSD.org
Thu Oct 1 17:08:38 UTC 2015
Author: ume
Date: Thu Oct 1 17:08:36 2015
New Revision: 398373
URL: https://svnweb.freebsd.org/changeset/ports/398373
Log:
Use SUB_FILES.
Added:
head/security/cyrus-sasl2/files/pkg-deinstall.in
- copied unchanged from r398371, head/security/cyrus-sasl2/pkg-deinstall
head/security/cyrus-sasl2/files/pkg-install.in
- copied unchanged from r398162, head/security/cyrus-sasl2/pkg-install
head/security/cyrus-sasl2/files/pkg-message.in
- copied unchanged from r398162, head/security/cyrus-sasl2/pkg-message
Deleted:
head/security/cyrus-sasl2/pkg-deinstall
head/security/cyrus-sasl2/pkg-install
head/security/cyrus-sasl2/pkg-message
Modified:
head/security/cyrus-sasl2/Makefile
Modified: head/security/cyrus-sasl2/Makefile
==============================================================================
--- head/security/cyrus-sasl2/Makefile Thu Oct 1 17:07:48 2015 (r398372)
+++ head/security/cyrus-sasl2/Makefile Thu Oct 1 17:08:36 2015 (r398373)
@@ -137,26 +137,15 @@ HTDOCS= advanced appconvert components g
mechanisms options plugprog programming readme sysadmin upgrading \
windows
+SUB_FILES= pkg-deinstall pkg-install pkg-message
+SUB_LIST= CYRUS_USER=${CYRUS_USER} CYRUS_GROUP=${CYRUS_GROUP} \
+ SASLDB=${SASLDB_NAME}
+
PLIST_SUB+= PREFIX=${PREFIX} \
SQL=${SQL} \
DOCSDIR=${DOCSDIR:S/^${PREFIX}\///}
-PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
-PKGINSTALL= ${WRKDIR}/pkg-install
-PKGMESSAGE= ${WRKDIR}/pkg-message
-
post-patch:
-# Fix sasldb name in pkg-install/deinstall scripts
- @${SED} -e "s;%%SASLDB%%;${SASLDB_NAME};g" \
- -e "s;%%CYRUS_USER%%;${CYRUS_USER};g" \
- -e "s;%%CYRUS_GROUP%%;${CYRUS_GROUP};g" \
- ${.CURDIR}/pkg-install > ${PKGINSTALL}
- @${SED} -e "s;%%SASLDB%%;${SASLDB_NAME};g" \
- -e "s;%%CYRUS_USER%%;${CYRUS_USER};g" \
- -e "s;%%CYRUS_GROUP%%;${CYRUS_GROUP};g" \
- ${.CURDIR}/pkg-deinstall > ${PKGDEINSTALL}
- @${SED} -e "s;%%PREFIX%%;${PREFIX};g" \
- ${.CURDIR}/pkg-message > ${PKGMESSAGE}
# Try to unbreak parallel (-jX) builds, part 1: make build commands atomic
@${FIND} ${WRKSRC} -name Makefile.in | ${XARGS} ${PERL} -w0pi.bak \
-e 's/(^\@am__fastdepCC_TRUE\@.*?) \
Copied: head/security/cyrus-sasl2/files/pkg-deinstall.in (from r398371, head/security/cyrus-sasl2/pkg-deinstall)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/cyrus-sasl2/files/pkg-deinstall.in Thu Oct 1 17:08:36 2015 (r398373, copy of r398371, head/security/cyrus-sasl2/pkg-deinstall)
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# Created by: hetzels at westbend.net
+
+#set -vx
+
+PKG_BATCH=${BATCH:=NO}
+
+PKG_PREFIX=${PKG_PREFIX:=/usr/local}
+
+SASLDB_NAME=${PKG_PREFIX}/etc/%%SASLDB%%
+
+CYRUS_USER=${CYRUS_USER:=%%CYRUS_USER%%}
+CYRUS_GROUP=${CYRUS_GROUP:=%%CYRUS_GROUP%%}
+
+# delete sasldb database
+
+delete_sasldb() {
+ if [ -f ${SASLDB_NAME} ] ; then
+ if [ `${PKG_PREFIX}/sbin/sasldblistusers2 | wc -l` -eq 0 ]; then
+ rm ${SASLDB_NAME}
+ else
+ echo "WARNING: Users SASL passwords are in ${SASLDB_NAME}, keeping this file"
+ fi
+ fi
+}
+
+delete_user() {
+ if pw usershow ${CYRUS_USER} 2>/dev/null 1>&2; then
+ echo "To delete Cyrus user permanently, use 'pw userdel ${CYRUS_USER}'"
+ fi
+ if pw groupshow ${CYRUS_GROUP} 2>/dev/null 1>&2; then
+ echo "To delete Cyrus group permanently, use 'pw groupdel ${CYRUS_GROUP}'"
+ fi
+
+}
+
+case $2 in
+ DEINSTALL)
+ delete_sasldb
+ ;;
+ POST-DEINSTALL)
+ delete_user
+ ;;
+
+esac
Copied: head/security/cyrus-sasl2/files/pkg-install.in (from r398162, head/security/cyrus-sasl2/pkg-install)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/cyrus-sasl2/files/pkg-install.in Thu Oct 1 17:08:36 2015 (r398373, copy of r398162, head/security/cyrus-sasl2/pkg-install)
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# Created by: stb at FreeBSD.org for the cyrus imap server
+# Added to the cyrus-sasl port by hetzels at westbend.net
+
+#set -vx
+
+PKG_BATCH=${BATCH:=NO}
+
+PKG_PREFIX=${PKG_PREFIX:=/usr/local}
+
+SASLDB_NAME=${PKG_PREFIX}/etc/%%SASLDB%%
+
+CYRUS_USER=${CYRUS_USER:=%%CYRUS_USER%%}
+CYRUS_GROUP=${CYRUS_GROUP:=%%CYRUS_GROUP%%}
+
+#
+# create 'cyrus' user and group before installing
+#
+
+create_user() {
+ USER=${CYRUS_USER}
+ GROUP=${CYRUS_GROUP}
+ PW=/usr/sbin/pw
+
+ if [ -x /usr/sbin/nologin ]; then
+ shell=/usr/sbin/nologin
+ elif [ -x /sbin/nologin ]; then
+ shell=/sbin/nologin
+ else
+ shell=/nonexistent
+ fi
+ uhome="/nonexistent"
+
+ if ! ${PW} show group ${GROUP} -q >/dev/null; then
+ gid=60
+ while ${PW} show group -g ${gid} -q >/dev/null; do
+ gid=`expr ${gid} + 1`
+ done
+ if ! ${PW} add group ${GROUP} -g ${gid}; then
+ e=$?
+ echo "*** Failed to add group \`${GROUP}'. Please add it manually."
+ exit ${e}
+ fi
+ echo "*** Added group \`${GROUP}' (id ${gid})"
+ else
+ gid=`${PW} show group ${GROUP} 2>/dev/null | cut -d: -f3`
+ fi
+
+ if ! ${PW} show user ${USER} -q >/dev/null; then
+ uid=60
+ while ${PW} show user -u ${uid} -q >/dev/null; do
+ uid=`expr ${uid} + 1`
+ done
+ if ! ${PW} add user ${USER} -u ${uid} -g ${gid} -d "${uhome}" \
+ -c "the cyrus mail server" -s "${shell}" -w no \
+ ; then
+ e=$?
+ echo "*** Failed to add user \`${USER}'. Please add it manually."
+ exit ${e}
+ fi
+ echo "*** Added user \`${USER}' (id ${uid})"
+ else
+ if ! ${PW} mod user ${USER} -g ${gid}; then
+ e=$?
+ echo "*** Failed to update user \`${USER}'."
+ exit ${e}
+ fi
+ echo "*** Updated user \`${USER}'."
+ fi
+}
+
+create_sasldb() {
+ if [ ! -f ${SASLDB_NAME} ]; then
+ echo "test" | ${PKG_PREFIX}/sbin/saslpasswd2 -p -c ${CYRUS_USER}
+ if [ `${PKG_PREFIX}/sbin/sasldblistusers2 | wc -l` -eq 0 ] ; then
+ echo "WARNING: Failed to create ${SASLDB_NAME}"
+ else
+ ${PKG_PREFIX}/sbin/saslpasswd2 -d ${CYRUS_USER}
+ chown ${CYRUS_USER}:mail ${SASLDB_NAME}
+ chmod 640 ${SASLDB_NAME}
+ fi
+ fi
+}
+
+case $2 in
+ PRE-INSTALL)
+ create_user
+ ;;
+ POST-INSTALL)
+ if [ "${PKG_BATCH}" = "NO" ]; then
+ create_sasldb
+ elif [ ! -f ${SASLDB_NAME} ]; then
+ echo "*** We do not create ${SASLDB_NAME} automatically in"
+ echo "*** BATCH mode. Please create it by yourself. It should be"
+ echo "*** owner: ${CYRUS_USER}, group: mail, mode: 0640."
+ fi
+ ;;
+
+esac
Copied: head/security/cyrus-sasl2/files/pkg-message.in (from r398162, head/security/cyrus-sasl2/pkg-message)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/cyrus-sasl2/files/pkg-message.in Thu Oct 1 17:08:36 2015 (r398373, copy of r398162, head/security/cyrus-sasl2/pkg-message)
@@ -0,0 +1,20 @@
+
+You can use sasldb2 for authentication, to add users use:
+
+ saslpasswd2 -c username
+
+If you want to enable SMTP AUTH with the system Sendmail, read
+Sendmail.README
+
+NOTE: This port has been compiled with a default pwcheck_method of
+ auxprop. If you want to authenticate your user by /etc/passwd,
+ PAM or LDAP, install ports/security/cyrus-sasl2-saslauthd and
+ set sasl_pwcheck_method to saslauthd after installing the
+ Cyrus-IMAPd 2.X port. You should also check the
+ %%PREFIX%%/lib/sasl2/*.conf files for the correct
+ pwcheck_method.
+ If you want to use GSSAPI mechanism, install
+ ports/security/cyrus-sasl2-gssapi.
+ If you want to use LDAP auxprop plugin, install
+ ports/security/cyrus-sasl2-ldapdb.
+
More information about the svn-ports-all
mailing list