head	1.21;
access;
symbols
	RELEASE_8_3_0:1.20
	RELEASE_9_0_0:1.20
	RELEASE_7_4_0:1.20
	RELEASE_8_2_0:1.20
	RELEASE_6_EOL:1.20
	RELEASE_8_1_0:1.20
	RELEASE_7_3_0:1.20
	RELEASE_8_0_0:1.20
	RELEASE_7_2_0:1.20
	RELEASE_7_1_0:1.20
	RELEASE_6_4_0:1.20
	RELEASE_5_EOL:1.20
	RELEASE_7_0_0:1.20
	RELEASE_6_3_0:1.20
	PRE_XORG_7:1.20
	RELEASE_4_EOL:1.20
	RELEASE_6_2_0:1.20
	RELEASE_6_1_0:1.19
	RELEASE_5_5_0:1.19
	RELEASE_6_0_0:1.19
	RELEASE_5_4_0:1.19
	RELEASE_4_11_0:1.19
	RELEASE_5_3_0:1.18
	RELEASE_4_10_0:1.18
	RELEASE_5_2_1:1.15
	RELEASE_5_2_0:1.15
	RELEASE_4_9_0:1.15
	RELEASE_5_1_0:1.12
	RELEASE_4_8_0:1.12
	RELEASE_5_0_0:1.11
	RELEASE_4_7_0:1.11
	old_RELEASE_4_6_1:1.8
	old_RELEASE_4_6_0:1.8
	old_RELEASE_5_0_DP1:1.6
	old_RELEASE_4_5_0:1.6
	old_RELEASE_4_4_0:1.4
	old_RELEASE_4_3_0:1.4
	old_RELEASE_4_2_0:1.3
	old_RELEASE_4_1_1:1.2
	old_RELEASE_4_1_0:1.1
	old_RELEASE_3_5_0:1.1
	old_RELEASE_4_0_0:1.1;
locks; strict;
comment	@# @;


1.21
date	2012.11.17.06.01.03;	author svnexp;	state Exp;
branches;
next	1.20;

1.20
date	2006.05.26.18.49.05;	author ume;	state Exp;
branches;
next	1.19;

1.19
date	2004.11.09.07.47.24;	author ume;	state Exp;
branches;
next	1.18;

1.18
date	2004.03.31.16.56.31;	author ume;	state Exp;
branches;
next	1.17;

1.17
date	2004.03.30.15.33.55;	author ume;	state Exp;
branches;
next	1.16;

1.16
date	2004.03.30.15.28.07;	author ume;	state Exp;
branches;
next	1.15;

1.15
date	2003.07.20.06.29.25;	author ume;	state Exp;
branches;
next	1.14;

1.14
date	2003.06.07.11.46.04;	author ume;	state Exp;
branches;
next	1.13;

1.13
date	2003.06.01.04.21.05;	author ume;	state Exp;
branches;
next	1.12;

1.12
date	2003.01.30.14.04.02;	author ume;	state Exp;
branches;
next	1.11;

1.11
date	2002.08.29.17.57.31;	author ume;	state Exp;
branches;
next	1.10;

1.10
date	2002.08.08.14.04.43;	author ume;	state Exp;
branches;
next	1.9;

1.9
date	2002.06.26.18.49.21;	author pat;	state Exp;
branches;
next	1.8;

1.8
date	2002.05.24.02.01.13;	author dwcjr;	state Exp;
branches;
next	1.7;

1.7
date	2002.05.21.15.08.58;	author dwcjr;	state Exp;
branches;
next	1.6;

1.6
date	2002.01.17.15.04.35;	author kevlo;	state Exp;
branches;
next	1.5;

1.5
date	2001.12.20.12.18.57;	author ijliao;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.17.15.06.21;	author kevlo;	state Exp;
branches;
next	1.3;

1.3
date	2000.11.01.11.59.16;	author jeh;	state Exp;
branches;
next	1.2;

1.2
date	2000.09.19.02.59.28;	author ade;	state Exp;
branches;
next	1.1;

1.1
date	2000.01.24.05.22.21;	author steve;	state Exp;
branches;
next	;


desc
@@


1.21
log
@Switch exporter over
@
text
@#!/bin/sh
#
#	$FreeBSD: head/security/cyrus-sasl2/pkg-install 300897 2012-07-14 14:29:18Z beat $
#
# 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}" -p "*" \
				; 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
@


1.20
log
@Correct pathname in warning message.

Reported by:	nork
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.19 2004/11/09 07:47:24 ume Exp $
@


1.19
log
@warn to create sasldb2 by yourself in BATCH mode.

Suggested by:	matusita
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.18 2004/03/31 16:56:31 ume Exp $
d79 1
a79 1
                        echo "WARNING: Failed to create ${PKG_PREFIX}/etc/$SASLDB_NAME}"
@


1.18
log
@prefer /usr/sbin/nologin than /sbin/nologin when creating user cyrus.

Requested by:	nork
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.17 2004/03/30 15:33:55 ume Exp $
d95 4
@


1.17
log
@When there is user cyrus, don't overwrite the user.  It helps
updating cyrus-sasl2 without updating cyrus-imapd*.
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.16 2004/03/30 15:28:07 ume Exp $
d28 3
a30 1
	if [ -x /sbin/nologin ]; then
@


1.16
log
@cosmetic changes.
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.15 2003/07/20 06:29:25 ume Exp $
d64 1
a64 3
		if ! ${PW} mod user ${USER} -g ${gid} -d "${uhome}" \
				-c "the cyrus mail server" -s "${shell}" -p "*" \
				; then
@


1.15
log
@Stop installing Sendmail.conf by cyrus-sasl2, and it is now installed
by cyrus-sasl2-saslauthd.  Since if Sendmail.conf is not installed,
SASL2 uses auxprop by default, it is enough to install Sendmail.conf
by saslauthd port.
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.14 2003/06/07 11:46:04 ume Exp $
d26 1
a26 1
	PW=/usr/sbin/pw 
d28 5
a32 5
	if [ -x /sbin/nologin ]; then   
		shell=/sbin/nologin   
	else   
		shell=/nonexistent   
	fi 
@


1.14
log
@Sync with cyrus-sasl port.  There is no functional change.

Obtained from:	cyrus-sasl port
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.13 2003/06/01 04:21:05 ume Exp $
a87 8
# This should really be installed by Sendmail

sendmail_conf() {
	if [ ! -f ${PKG_PREFIX}/lib/sasl2/Sendmail.conf ]; then
		echo "pwcheck_method: auxprop" > ${PKG_PREFIX}/lib/sasl2/Sendmail.conf
	fi
}

a94 1
			sendmail_conf
@


1.13
log
@- Make saslauthd a separate port to avoid dependency loop between
  cyrus-sasl2 and openldap.
- Stop using configuration menu.  I believe it ease to maintain
  consistency with other SASL related ports.
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.12 2003/01/30 14:04:02 ume Exp $
a72 6
# Don't know why we need the daemon user in the cyrus group
# hopefully this doesn't affect anyone. It's a leftover from
# the pre-SASL cyrus-imapd server.
#	if ! ${PW} group mod ${GROUP} -m daemon; then
#		echo "*** can't add user \`daemon' to group \`${GROUP}'"
#	fi
@


1.12
log
@Add CYRUS_USER and CYRUS_GROUP options to be able to configure
psuedo user for cyrus.

Requested by:	Cyrus Anderson Yunker <cayunker@@unity.ncsu.edu>
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.11 2002/08/29 17:57:31 ume Exp $
d98 1
a98 1
		echo "pwcheck_method: %%PWCHECK_METHOD%%" > ${PKG_PREFIX}/lib/sasl2/Sendmail.conf
@


1.11
log
@Add description about sendmail with SASLv2.
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.10 2002/08/08 14:04:43 ume Exp $
d16 3
d24 2
a25 2
	USER=cyrus
	GROUP=cyrus
d83 1
a83 1
		echo "test" | ${PKG_PREFIX}/sbin/saslpasswd2 -p -c cyrus
d87 2
a88 2
			${PKG_PREFIX}/sbin/saslpasswd2 -d cyrus
			chown cyrus:mail ${SASLDB_NAME}
@


1.10
log
@Add cyrus-sasl-2.1.6 after repo. copy.
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl2/pkg-install,v 1.9 2002/06/26 18:49:21 pat Exp $
d91 8
d106 1
@


1.9
log
@- Chase checksum for sasl-1.5.27-ldap-ssl-filter-mysql-patch4.tgz
  author fixed bug in patch but didn't increment version.
- Fix problem when openldap v1 is selected.
- Bump PORTREVISION

PR:		ports/39800
Submitted by:	maintainer
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl/pkg-install,v 1.8 2002/05/24 02:01:13 dwcjr Exp $
d80 2
a81 2
		echo "test" | ${PKG_PREFIX}/sbin/saslpasswd -p -c cyrus
		if [ `${PKG_PREFIX}/sbin/sasldblistusers | wc -l` -eq 0 ] ; then
d84 1
a84 1
			${PKG_PREFIX}/sbin/saslpasswd -d cyrus
a90 8
# This should really be installed by Sendmail

sendmail_conf() {
	if [ ! -f ${PKG_PREFIX}/lib/sasl/Sendmail.conf ]; then
		echo "pwcheck_method: pwcheck" > ${PKG_PREFIX}/lib/sasl/Sendmail.conf
	fi
}

a97 1
			sendmail_conf
@


1.8
log
@Do not add a shell to cyrus user.

PR:		38434
Submitted by:	maintainer
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl/pkg-install,v 1.7 2002/05/21 15:08:58 dwcjr Exp $
d70 6
a75 3
	if ! ${PW} group mod ${USER} -m daemon; then
		echo "*** can't add user \`${USER}' to group \`${GROUP}'"
	fi
@


1.7
log
@Fix for DB3 & KRB4

PR:		38363
Submitted by:	maintainer
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl/pkg-install,v 1.6 2002/01/17 15:04:35 kevlo Exp $
d21 10
a30 4
	if [ ! -x /usr/sbin/pw ]; then
		echo "*** Please add a user and a group named \`cyrus' before installing this package."
		exit 69
	fi
d32 1
a32 1
	if ! pw show group cyrus -q >/dev/null; then
d34 1
a34 1
		while pw show group -g ${gid} -q >/dev/null; do
d37 1
a37 1
		if ! pw add group cyrus -g ${gid}; then
d39 1
a39 1
			echo "*** Failed to add group \`cyrus'. Please add it manually."
d42 1
a42 1
		echo "*** Added group \`cyrus' (id ${gid})"
d44 1
a44 1
		gid=`pw show group cyrus 2>/dev/null | cut -d: -f3`
d47 1
a47 1
	if ! pw show user cyrus -q >/dev/null; then
d49 1
a49 1
		while pw show user -u ${uid} -q >/dev/null; do
d52 2
a53 2
		if ! pw add user cyrus -u ${uid} -g ${gid} -d "${PKG_PREFIX}/cyrus" \
				-c "the cyrus mail server" -s "/bin/csh" -p "*" \
d56 1
a56 1
			echo "*** Failed to add user \`cyrus'. Please add it manually."
d59 1
a59 1
		echo "*** Added user \`cyrus' (id ${uid})"
d61 2
a62 2
		if ! pw mod user cyrus -g ${gid} -d "${PKG_PREFIX}/cyrus" \
				-c "the cyrus mail server" -s "/bin/csh" -p "*" \
d65 1
a65 1
			echo "*** Failed to update user \`cyrus'."
d68 1
a68 1
		echo "*** Updated user \`cyrus'."
d70 2
a71 2
	if ! pw group mod cyrus -m daemon; then
		echo "*** can't add user \`daemon' to group \`cyrus'"
@


1.6
log
@Update to version 1.5.27

PR: 33603
Submitted by: MAINTAINER
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl/pkg-install,v 1.5 2001/12/20 12:18:57 ijliao Exp $
a40 5
	if [ -x /sbin/nologin ]; then
		shell=/sbin/nologin
	else
		shell=/nonexistent
	fi
d46 2
a47 2
		if ! pw add user cyrus -u ${uid} -g ${gid} -d "/nonexistent" \
				-c "the cyrus mail server" -s "${shell}" -p "*" \
d55 2
a56 2
		if ! pw mod user cyrus -g ${gid} -d "/nonexistent" \
				-c "the cyrus mail server" -s "${shell}" -p "*" \
d72 7
a78 3
		${PKG_PREFIX}/sbin/saslpasswd -d cyrus
		chown cyrus:mail ${SASLDB_NAME}
		chmod 640 ${SASLDB_NAME}
@


1.5
log
@refer to correct location in pkg-message
correct db filename
fix pkg-install script

PR:		29731
Submitted by:	maintainer
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl/pkg-install,v 1.4 2000/11/17 15:06:21 kevlo Exp $
d76 2
a77 1
		touch ${SASLDB_NAME}
@


1.4
log
@- Correct misspelling (PGK_PREFIX -> PKG_PREFIX) in pkg-install
- Add support for Heimdal Kerberos V port

PR: 22894
Submitted by: MAINTAINER
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl/pkg-install,v 1.3 2000/11/01 11:59:16 jeh Exp $
d14 2
d75 4
a78 4
	if [ ! -f ${PGK_PREFIX}/etc/sasldb.db ]; then
		touch ${PKG_PREFIX}/etc/sasldb.db
		chown cyrus:mail ${PKG_PREFIX}/etc/sasldb.db
		chmod 640 ${PKG_PREFIX}/etc/sasldb.db
@


1.3
log
@- Change /var/pwcheck permissions so Postfix can use pwcheck for SASL Authentication.
- Update MySQL & LDAP Authentication Methods
- Correct bento warning for extra file (Sendmail.conf).
- Correct mysql detection code in configure.sasl, and use LIB_DEPENDS for db3.

PR:		22462
Submitted by:	Scot W. Hetzel <hetzels@@westbend.net> MAINTAINER
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl/pkg-install,v 1.2 2000/09/19 02:59:28 ade Exp $
d74 3
a76 3
		touch ${PGK_PREFIX}/etc/sasldb.db
		chown cyrus:mail ${PGK_PREFIX}/etc/sasldb.db
		chmod 640 ${PGK_PREFIX}/etc/sasldb.db
@


1.2
log
@Cyrus-SASL 1.5.24 sources changed on Aug 15th
-- changed a hard coded value to a variable.

Kerberos IV detection fails due to double check on krb_mk_priv
(with/without com_err), used cached value from first check for krb_mk_priv.

Added addtional pwcheck methods (MySQL & LDAP Authentication).

PR:		21383
Submitted by:	maintainer
@
text
@d3 1
a3 1
#	$FreeBSD: ports/security/cyrus-sasl/pkg/INSTALL,v 1.1 2000/01/24 05:22:21 steve Exp $
d6 1
a6 1
# Added to the cyrus-sasl port by hetzel@@westbend.net
@


1.1
log
@Update to version 1.5.15.

PR:		16130
Submitted by:	maintainer
@
text
@d3 1
a3 1
#	$FreeBSD$
d10 4
d18 1
a18 1
create() {
d72 16
d90 7
a96 1
		create
@

