1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-13 03:03:15 +00:00
freebsd-ports/security/cyrus-sasl/scripts/configure.sasl
Volker Stolz 592846cb9b Chase OpenLDAP 2.2
PR:		ports/74069
Submitted by:	ceri
2004-12-09 10:06:04 +00:00

238 lines
5.9 KiB
Bash

#!/bin/sh
# $FreeBSD$
if [ -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc ]; then
exit
fi
tempfile=`mktemp -t checklist`
if [ "${BATCH}" ]; then
if [ "${WITH_DB3}" ]; then
OPTIONS="\"DB3\""
else
OPTIONS="\"NDBM\""
fi
if [ "${WITH_JAVA}" ]; then
OPTIONS="${OPTIONS} \"JAVA\""
fi
if [ "${WITH_MYSQL}" ]; then
OPTIONS="${OPTIONS} \"MySQL\""
fi
if [ "${WITH_LDAP2}" ]; then
OPTIONS="${OPTIONS} \"OpenLDAP2\""
elif [ "${WITH_LDAP1}" ]; then
OPTIONS="${OPTIONS} \"OpenLDAP1\""
fi
if [ "${OPTIONS}" != "x" ]; then
OPTIONS="${OPTIONS} \"SASLAUTHD\""
set ${OPTIONS}
fi
else
if [ "${WITH_DB3}" -o -f ${PREFIX}/lib/libdb3.so ] ; then
SET_DB3="ON"
SET_NDBM="OFF"
else
SET_DB3="OFF"
SET_NDBM="ON"
fi
if [ "${WITH_JAVA}" ] ; then
SET_JAVA="ON"
else
SET_JAVA="OFF"
fi
if [ "${WITH_MYSQL}" -o -f ${PREFIX}/lib/mysql/libmysqlclient.so ] ; then
SET_MYSQL="ON"
else
SET_MYSQL="OFF"
fi
#Prefer LDAP2 over LDAP1
SET_LDAP1="OFF"
SET_LDAP2="OFF"
if [ "${WITH_LDAP2}" -o -f ${PREFIX}/lib/libldap-2.2.so -a -f ${PREFIX}/lib/liblber-2.2.so ] ; then
SET_LDAP2="ON"
elif [ "${WITH_LDAP1}" -o -f ${PREFIX}/lib/libldap.so.1 -a -f ${PREFIX}/lib/liblber.so.1 ]; then
SET_LDAP1="ON"
fi
/usr/bin/dialog --title "Additional Cyrus SASL options" --clear \
--checklist "\n\
Please select desired options:" -1 -1 16 \
NDBM "ndbm DB" ${SET_NDBM} \
DB3 "Berkeley DB, revision 3" ${SET_DB3} \
JAVA "JavaSASL [Experimental]" ${SET_JAVA} \
MySQL "MySQL password Authentication" ${SET_MYSQL} \
OpenLDAP1 "OpenLDAP 1.x password Authentication" ${SET_LDAP1} \
OpenLDAP2 "OpenLDAP 2.x password Authentication w/TLS" ${SET_LDAP2} \
PWCHECK "Use pwcheck for password Authentication" OFF \
PAMPWCHECK "Use pwcheck_pam for password Authentication" OFF \
SASLAUTHD "Use saslauthd for password Authentication" ON \
2> $tempfile
retval=$?
if [ -s $tempfile ]; then
set `cat $tempfile`
fi
rm -f $tempfile
case $retval in
0) if [ -z "$*" ]; then
echo "Nothing selected"
OPTIONS="\"NDBM\""
set ${OPTIONS}
fi
;;
1) echo "Cancel pressed."
exit 1
;;
esac
fi
${MKDIR} ${WRKDIRPREFIX}${REALCURDIR}
exec > ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
echo "PREFIX= ${PREFIX}"
while [ "$1" ]; do
case $1 in
\"NDBM\")
if [ "${DBLIB}" ]; then
echo "ndbm and db3 are mutually exclusive." > /dev/stderr
rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
exit 1
fi
echo "CONFIGURE_ARGS+= --with-dblib=ndbm"
echo "SASLDB_NAME= sasldb.db"
DBLIB=1
;;
\"DB3\")
if [ "${DBLIB}" ]; then
echo "ndbm and db3 are mutually exclusive." > /dev/stderr
rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
exit 1
fi
echo "LIB_DEPENDS+= db3.3:\${PORTSDIR}/databases/db3"
echo "CONFIGURE_ARGS+= --with-dblib=berkeley"
echo "SASLDB_NAME= sasldb"
DBLIB=1
;;
\"JAVA\")
echo "BUILD_DEPENDS+= \${LOCALBASE}/\${JAVADIR}/bin/java:\${PORTSDIR}/java/jdk13"
echo "RUN_DEPENDS+= \${LOCALBASE}/\${JAVADIR}/bin/java:\${PORTSDIR}/java/jdk13"
echo "USE_GMAKE= yes"
echo "CONFIGURE_ARGS+= --enable-java \\"
echo " --with-javabase=\${LOCALBASE}/\${JAVADIR}"
echo "CONFIGURE_ENV+= JAVAC=\"\${LOCALBASE}/\${JAVADIR}/bin/javac\" \\"
echo " JAVAH=\"\${LOCALBASE}/\${JAVADIR}/bin/javah\" \\"
echo " JAVADOC=\"\${LOCALBASE}/\${JAVADIR}/bin/javadoc\""
echo "PLIST_SUB+= JAVASASL=\"\""
DEFJAVA=1
;;
\"MySQL\")
echo "LIB_DEPENDS+= mysqlclient.10:\${PORTSDIR}/databases/mysql323-client"
echo "CONFIGURE_ARGS+= --with-mysql=\${PREFIX}"
MYSQL_REQ=mysql
MSG=1
;;
\"OpenLDAP1\")
if [ "$OPENLDAP" ]; then
echo "OpenLDAP1 and OpenLDAP2 are mutually exclusive." > /dev/stderr
rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
exit 1
fi
echo "LIB_DEPENDS+= ldap.1:\${PORTSDIR}/net/openldap12"
echo "LIB_DEPENDS+= lber.1:\${PORTSDIR}/net/openldap12"
echo "CONFIGURE_ARGS+= --with-ldap=\${PREFIX}"
LDAP_REQ=ldap
OPENLDAP=1
MSG=1
;;
\"OpenLDAP2\")
if [ "$OPENLDAP" ]; then
echo "OpenLDAP1 and OpenLDAP2 are mutually exclusive." > /dev/stderr
rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
exit 1
fi
echo "LIB_DEPENDS+= ldap-2.2:\${PORTSDIR}/net/openldap22-client"
echo "LIB_DEPENDS+= lber-2.2:\${PORTSDIR}/net/openldap22-client"
echo "CONFIGURE_ARGS+= --with-ldap=\${PREFIX}"
LDAP_REQ=ldap
OPENLDAP=1
MSG=1
;;
\"PWCHECK\")
if [ "$PWCHECK" ]; then
echo "PWCHECK or PAMPWCHECK must be choosen seperately: Defaulting to PAMPWCHECK" > /dev/stderr
else
PWCHECK=pwcheck
fi
;;
\"PAMPWCHECK\")
if [ "$PWCHECK" ]; then
echo "PWCHECK or PAMPWCHECK must be choosen seperately: Defaulting to PWCHECK" > /dev/stderr
else
PWCHECK=pwcheck_pam
fi
;;
\"SASLAUTHD\")
if [ "$PWCHECK" ]; then
echo "SASLAUTHD is preferred over PWCHECK: Enabling saslauthd and disabling pwcheck in rc.d scripts" > /dev/stderr
fi
SASLAUTHD=1
;;
*)
echo "Invalid option(s): $*" > /dev/stderr
rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
exit 1
;;
esac
shift
done
if [ "${SASLAUTHD}" ]; then
ENABLE_PWCHECK=no
PWCHECK_METHOD=saslauthd
ENABLE_SASLAUTHD=yes
if [ -z "${PWCHECK}" ]; then
PWCHECK=pwcheck
fi
else
if [ "${PWCHECK}" ]; then
ENABLE_PWCHECK=yes
else
ENABLE_PWCHECK=no
PWCHECK=pwcheck
fi
PWCHECK_METHOD=pwcheck
ENABLE_SASLAUTHD=no
fi
if [ ! "${DEFJAVA}" ]; then
echo "PLIST_SUB+= JAVASASL=\"@comment \""
fi
if [ ! "${DBLIB}" ]; then
echo "CONFIGURE_ARGS+= --with-dblib=ndbm"
echo "SASLDB_NAME= sasldb.db"
fi
echo "PWCHECK= ${PWCHECK}"
echo "PWCHECK_METHOD= ${PWCHECK_METHOD}"
echo "ENABLE_PWCHECK= ${ENABLE_PWCHECK}"
echo "ENABLE_SASLAUTHD= ${ENABLE_SASLAUTHD}"
if [ "${MSG}" ]; then
if [ -n "${LDAP_REQ}" ]; then
METHOD="LDAP"
if [ -n "${MYSQL_REQ}" ]; then
METHOD="LDAP or MySQL"
fi
elif [ -n "${MYSQL_REQ}" ]; then
METHOD="MySQL"
fi
echo "LDAP_MYSQL_MSG= \"See sysadmin.html in the Cyrus-SASL docs directory for informaion on using ${METHOD} for authentication.\""
fi