From owner-svn-ports-head@freebsd.org Thu Oct 1 17:08:38 2015 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0C62A0DFDE; Thu, 1 Oct 2015 17:08:38 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95FFA19C8; Thu, 1 Oct 2015 17:08:38 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91H8cJZ098366; Thu, 1 Oct 2015 17:08:38 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91H8bu5098362; Thu, 1 Oct 2015 17:08:37 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201510011708.t91H8bu5098362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Thu, 1 Oct 2015 17:08:37 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r398373 - in head/security/cyrus-sasl2: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 17:08:38 -0000 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@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@FreeBSD.org for the cyrus imap server +# Added to the cyrus-sasl port by hetzels@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. +