diff options
author | jlam <jlam> | 2001-11-21 22:22:10 +0000 |
---|---|---|
committer | jlam <jlam> | 2001-11-21 22:22:10 +0000 |
commit | 12a20481ddcfbf3ee78801d7c51bbc68dd4400a8 (patch) | |
tree | 97c67f3a10af4a76a78429ca6156ac5572851916 | |
parent | ca54febce3487557911cd62c12e4ba0a8aa138ed (diff) | |
download | pkgsrc-12a20481ddcfbf3ee78801d7c51bbc68dd4400a8.tar.gz |
Buildlinkify, respect ${CONFDIR}, use general INSTALL/DEINSTALL scripts,
and make sasl_passwd into a real rc.d script.
-rw-r--r-- | security/cyrus-sasl/DEINSTALL | 38 | ||||
-rw-r--r-- | security/cyrus-sasl/INSTALL | 83 | ||||
-rw-r--r-- | security/cyrus-sasl/Makefile | 83 | ||||
-rw-r--r-- | security/cyrus-sasl/PLIST.plugins | 4 | ||||
-rw-r--r-- | security/cyrus-sasl/buildlink.mk | 50 | ||||
-rw-r--r-- | security/cyrus-sasl/files/sasl_pwcheck.sh | 82 |
6 files changed, 136 insertions, 204 deletions
diff --git a/security/cyrus-sasl/DEINSTALL b/security/cyrus-sasl/DEINSTALL index 810f50e4120..27cb7306ec8 100644 --- a/security/cyrus-sasl/DEINSTALL +++ b/security/cyrus-sasl/DEINSTALL @@ -1,44 +1,22 @@ #!/bin/sh # -# $NetBSD: DEINSTALL,v 1.1 2001/11/01 01:16:36 zuntum Exp $ +# $NetBSD: DEINSTALL,v 1.2 2001/11/21 22:22:10 jlam Exp $ -PKGNAME=$1 -STAGE=$2 - -USER="@CYRUS_USER@" -GROUP="@CYRUS_GROUP@" - -CAT="@CAT@" -RM="@RM@" - -SASLDB=/etc/sasldb.db -PWCHECKDIR=/var/pwcheck +SASLDB=@CONFDIR@/sasldb.db +PWCHECKDIR=@PWCHECKDIR@ case ${STAGE} in -DEINSTALL) - ;; - POST-DEINSTALL) ${RM} -rf ${PWCHECKDIR} - ${CAT} << EOF + if [ -e ${SASLDB} ] + then + ${CAT} << EOF =========================================================================== -If you won't be using ${PKGNAME} any longer, you may want -to remove: - - * the \`${USER}' user - - * the \`${GROUP}' group - - * the following files: +You may want to remove the SASL password data file: ${SASLDB} =========================================================================== EOF - ;; - -*) - echo "Unexpected argument: ${STAGE}" - exit 1 + fi ;; esac -exit 0 diff --git a/security/cyrus-sasl/INSTALL b/security/cyrus-sasl/INSTALL deleted file mode 100644 index 5ae49d96ca3..00000000000 --- a/security/cyrus-sasl/INSTALL +++ /dev/null @@ -1,83 +0,0 @@ -#! /bin/sh -# -# $NetBSD: INSTALL,v 1.1 2001/11/01 01:16:36 zuntum Exp $ - -PKGNAME=$1 -STAGE=$2 - -USER="@CYRUS_USER@" -GROUP="@CYRUS_GROUP@" - -ADDUSER="@ADDUSER@" -ADDGROUP="@ADDGROUP@" -CHGRP="@CHGRP@" -CHMOD="@CHMOD@" -CHOWN="@CHOWN@" -ID="@ID@" -MKDIR="@MKDIR@" -RM="@RM@" -TOUCH="@TOUCH@" - -SASLDB=/etc/sasldb.db -PWCHECKDIR=/var/pwcheck - -case ${STAGE} in -PRE-INSTALL) - # Group... the default's shipped with NetBSD - # We need to check that ${GROUP} exists before adding the user. - # Do it with chgrp to be able to use NIS. - # - ${TOUCH} "/tmp/grouptest.$$" - ${CHGRP} ${GROUP} "/tmp/grouptest.$$" >/dev/null 2>&1 - if [ $? -eq 0 ] - then - echo "Group '${GROUP}' already exists...proceeding." - else - echo "Creating '${GROUP}' group..." - ${ADDGROUP} ${GROUP} - echo "Done." - fi - ${RM} -f "/tmp/grouptest.$$" - - # Use `id' to be able to use NIS. - # - ${ID} ${USER} 2>/dev/null >/dev/null - if [ $? -eq 0 ] - then - echo "User '${USER}' already exists...proceeding." - else - echo "Creating '${USER}' user..." - ${ADDUSER} -c "Cyrus User" -g ${GROUP} -s /bin/sh ${USER} - echo "Done." - fi - ;; - -POST-INSTALL) - # Create empty sasldb shared secrets database with proper permissions - # for saslpasswd. - # - if [ -f ${SASLDB} ] - then - echo "${SASLDB} already exists." - else - echo "Creating empty ${SASLDB}..." - echo password | ${PKG_PREFIX}/sbin/saslpasswd -p user - ${PKG_PREFIX}/sbin/saslpasswd -d user - ${CHOWN} ${USER} ${SASLDB} - ${CHMOD} 600 ${SASLDB} - echo "Done." - fi - - # Create directory with proper permissions for pwcheck socket. - # - ${MKDIR} ${PWCHECKDIR} - ${CHOWN} ${USER} ${PWCHECKDIR} - ${CHMOD} 700 ${PWCHECKDIR} - ;; - -*) - echo "Unexpected argument: ${STAGE}" - exit 1 - ;; -esac -exit 0 diff --git a/security/cyrus-sasl/Makefile b/security/cyrus-sasl/Makefile index c3f2359406c..aa88f9094e3 100644 --- a/security/cyrus-sasl/Makefile +++ b/security/cyrus-sasl/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.18 2001/10/18 15:20:34 veego Exp $ +# $NetBSD: Makefile,v 1.19 2001/11/21 22:22:10 jlam Exp $ DISTNAME= cyrus-sasl-1.5.24 PKGNAME= ${DISTNAME}nb3 @@ -13,10 +13,11 @@ COMMENT= Simple Authentication and Security Layer BUILD_DEPENDS+= automake>=1.4:../../devel/automake -GNU_CONFIGURE= # defined -USE_SSL= # defined -USE_GMAKE= # defined -USE_LIBTOOL= # defined +AUTOMAKE_OVERRIDE= YES +USE_BUILDLINK_ONLY= YES +GNU_CONFIGURE= YES +USE_GMAKE= YES +USE_LIBTOOL= YES LTCONFIG_OVERRIDE= ${WRKSRC}/config/ltconfig .include "../../mk/bsd.prefs.mk" @@ -27,20 +28,19 @@ LTCONFIG_OVERRIDE= ${WRKSRC}/config/ltconfig CYRUS_USER?= cyrus CYRUS_GROUP?= mail +HTMLDIR= ${PREFIX}/share/doc/html/cyrus-sasl +PWCHECKDIR= /var/pwcheck +FILES_SUBST+= PWCHECKDIR=${PWCHECKDIR} + BUILD_DEFS+= CYRUS_USER CYRUS_GROUP PLIST_SRC= ${PKGDIR}/PLIST.common -CONFIGURE_ARGS+= --with-pwcheck=/var/pwcheck +CONFIGURE_ARGS+= --with-pwcheck=${PWCHECKDIR} CONFIGURE_ARGS+= --with-dblib=ndbm -CONFIGURE_ARGS+= --with-dbpath=/etc/sasldb +CONFIGURE_ARGS+= --with-dbpath=${CONFDIR}/sasldb CONFIGURE_ARGS+= --with-plugindir=${PREFIX}/lib/sasl -CONFIGURE_ARGS+= --with-rc4=${SSLBASE} - -.if defined(USE_PAM) -CONFIGURE_ARGS+= --with-pam=${PREFIX} -DEPENDS+= PAM-[0-9]*:../../security/PAM -.endif +CONFIGURE_ARGS+= --with-rc4=${BUILDLINK_DIR} # Authentication mechanisms CONFIGURE_ARGS+= --enable-anon # ANONYMOUS @@ -54,6 +54,8 @@ CONFIGURE_ARGS+= --disable-srp # --- no SRP CONFIGURE_ARGS+= --disable-x509 # --- no X.509 .if defined(KERBEROS) +.undef USE_BUILDLINK_ONLY +.if ${OPSYS} == "NetBSD" USE_KERBEROS= # defined CONFIGURE_ARGS+= --enable-krb4=${PREFIX} --enable-gssapi=/usr # KERBEROS_V4 DEPENDS+= kth-krb4-[0-9]*:../../security/kth-krb4 @@ -65,57 +67,36 @@ PLIST_SRC+= ${PKGDIR}/PLIST.krb5 .else CONFIGURE_ARGS+= --disable-krb4 --disable-gssapi # --- no KERBEROS_V4 .endif +.endif PLIST_SRC+= ${PKGDIR}/PLIST.plugins -.if ${OPSYS} == "NetBSD" -.if exists(/usr/sbin/user) -ADDUSER= /usr/sbin/useradd -ADDGROUP= /usr/sbin/groupadd -.else -DEPENDS+= user>=20000313:../../sysutils/user -ADDUSER= ${LOCALBASE}/sbin/useradd -ADDGROUP= ${LOCALBASE}/sbin/groupadd -.endif -.elif ${OPSYS} == "SunOS" -ADDUSER= useradd -ADDGROUP= groupadd +.if defined(USE_PAM) +CONFIGURE_ARGS+= --with-pam=${PREFIX} +.include "../../security/PAM/buildlink.mk" .endif -DEINSTALL_FILE= ${WRKDIR}/DEINSTALL -INSTALL_FILE= ${WRKDIR}/INSTALL +PKG_USER= ${CYRUS_USER} +PKG_USER_SHELL= ${SH} +PKG_GROUP= ${CYRUS_GROUP} +RCD_SCRIPTS= sasl_pwcheck +OWN_DIRS_PERMS= ${PWCHECKDIR} ${PKG_USER} ${ROOT_GROUP} 0700 -HTMLDIR= ${PREFIX}/share/doc/html/cyrus-sasl +DEINSTALL_EXTRA_TMPL= ${PKGDIR}/DEINSTALL post-extract: cd ${WRKSRC}; ${RM} -f include/md5.h ${CP} ${FILESDIR}/sasl-config.in ${WRKSRC}/plugins pre-configure: - cd ${WRKSRC} && ${LOCALBASE}/bin/autoheader && ${LOCALBASE}/bin/autoconf && ${LOCALBASE}/bin/automake --gnu - -post-build: - ${SED} -e "s,@PREFIX@,${PREFIX},g" \ - < ${FILESDIR}/sasl_pwcheck.sh > ${WRKDIR}/sasl_pwcheck.sh + cd ${WRKSRC}; \ + ${LOCALBASE}/bin/autoheader; \ + ${LOCALBASE}/bin/automake --gnu; \ + ${LOCALBASE}/bin/autoconf pre-install: - ${SED} -e "s,@CYRUS_USER@,${CYRUS_USER},g" \ - -e "s,@CYRUS_GROUP@,${CYRUS_GROUP},g" \ - -e "s,@CAT@,${CAT},g" \ - -e "s,@RM@,${RM},g" \ - < ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE} - ${SED} -e "s,@CYRUS_USER@,${CYRUS_USER},g" \ - -e "s,@CYRUS_GROUP@,${CYRUS_GROUP},g" \ - -e "s,@ADDUSER@,${ADDUSER},g" \ - -e "s,@ADDGROUP@,${ADDGROUP},g" \ - -e "s,@CHGRP@,${CHGRP},g" \ - -e "s,@CHMOD@,${CHMOD},g" \ - -e "s,@CHOWN@,${CHOWN},g" \ - -e "s,@ID@,${ID},g" \ - -e "s,@MKDIR@,${MKDIR},g" \ - -e "s,@RM@,${RM},g" \ - -e "s,@TOUCH@,${TOUCH},g" \ - < ${PKGDIR}/INSTALL > ${INSTALL_FILE} + @${SED} ${FILES_SUBST_SED} ${FILESDIR}/sasl_pwcheck.sh \ + > ${WRKDIR}/sasl_pwcheck.sh PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL post-install: @@ -125,4 +106,6 @@ post-install: cd ${WRKSRC}/doc; ${INSTALL_DATA} *.html *.txt ${HTMLDIR} PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL +.include "../../security/openssl/buildlink.mk" +.include "../../mk/bsd.pkg.install.mk" .include "../../mk/bsd.pkg.mk" diff --git a/security/cyrus-sasl/PLIST.plugins b/security/cyrus-sasl/PLIST.plugins index fed360ef9ed..6560d366412 100644 --- a/security/cyrus-sasl/PLIST.plugins +++ b/security/cyrus-sasl/PLIST.plugins @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST.plugins,v 1.1 2001/11/01 01:22:02 zuntum Exp $ +@comment $NetBSD: PLIST.plugins,v 1.2 2001/11/21 22:22:10 jlam Exp $ lib/sasl/libanonymous.a lib/sasl/libanonymous.la lib/sasl/libanonymous.so @@ -19,4 +19,4 @@ lib/sasl/libplain.la lib/sasl/libplain.so lib/sasl/libplain.so.1 lib/sasl/libplain.so.1.14 -@unexec rmdir -p %D/lib/sasl 2>/dev/null || true +@unexec ${RMDIR} -p %D/lib/sasl 2>/dev/null || ${TRUE} diff --git a/security/cyrus-sasl/buildlink.mk b/security/cyrus-sasl/buildlink.mk new file mode 100644 index 00000000000..e7c6108ba26 --- /dev/null +++ b/security/cyrus-sasl/buildlink.mk @@ -0,0 +1,50 @@ +# $NetBSD: buildlink.mk,v 1.1 2001/11/21 22:22:10 jlam Exp $ +# +# This Makefile fragment is included by packages that use cyrus-sasl. +# +# To use this Makefile fragment, simply: +# +# (1) Optionally define BUILDLINK_DEPENDS.cyrus-sasl to the dependency pattern +# for the version of cyrus-sasl desired. +# (2) Include this Makefile fragment in the package Makefile, +# (3) Add ${BUILDLINK_DIR}/include to the front of the C preprocessor's header +# search path, and +# (4) Add ${BUILDLINK_DIR}/lib to the front of the linker's library search +# path. + +.if !defined(CYRUS_SASL_BUILDLINK_MK) +CYRUS_SASL_BUILDLINK_MK= # defined + +.include "../../mk/bsd.buildlink.mk" + +BUILDLINK_DEPENDS.cyrus-sasl?= cyrus-sasl>=1.5.24nb2 +DEPENDS+= ${BUILDLINK_DEPENDS.cyrus-sasl}:../../security/cyrus-sasl + +EVAL_PREFIX+= BUILDLINK_PREFIX.cyrus-sasl=cyrus-sasl +BUILDLINK_PREFIX.cyrus-sasl_DEFAULT= ${LOCALBASE} +BUILDLINK_FILES.cyrus-sasl= include/hmac-md5.h +BUILDLINK_FILES.cyrus-sasl+= include/sasl.h +BUILDLINK_FILES.cyrus-sasl+= include/saslplug.h +BUILDLINK_FILES.cyrus-sasl+= include/saslutil.h +BUILDLINK_FILES.cyrus-sasl+= lib/libsasl.* + +BUILDLINK_TARGETS.cyrus-sasl= cyrus-sasl-buildlink +BUILDLINK_TARGETS.cyrus-sasl+= cyrus-sasl-buildlink-config-wrapper +BUILDLINK_TARGETS+= ${BUILDLINK_TARGETS.cyrus-sasl} + +BUILDLINK_CONFIG.cyrus-sasl= ${BUILDLINK_PREFIX.cyrus-sasl}/bin/sasl-config +BUILDLINK_CONFIG_WRAPPER.cyrus-sasl= ${BUILDLINK_DIR}/bin/sasl-config +REPLACE_BUILDLINK_SED+= \ + -e "s|${BUILDLINK_CONFIG_WRAPPER.cyrus-sasl}|${BUILDLINK_CONFIG.cyrus-sasl}|g" + +.if defined(USE_CONFIG_WRAPPER) +SASL_CONFIG?= ${BUILDLINK_CONFIG_WRAPPER.cyrus-sasl} +CONFIGURE_ENV+= SASL_CONFIG="${SASL_CONFIG}" +MAKE_ENV+= SASL_CONFIG="${SASL_CONFIG}" +.endif + +pre-configure: ${BUILDLINK_TARGETS.cyrus-sasl} +cyrus-sasl-buildlink: _BUILDLINK_USE +cyrus-sasl-buildlink-config-wrapper: _BUILDLINK_CONFIG_WRAPPER_USE + +.endif # CYRUS_SASL_BUILDLINK_MK diff --git a/security/cyrus-sasl/files/sasl_pwcheck.sh b/security/cyrus-sasl/files/sasl_pwcheck.sh index 0be74555483..d8091bd999a 100644 --- a/security/cyrus-sasl/files/sasl_pwcheck.sh +++ b/security/cyrus-sasl/files/sasl_pwcheck.sh @@ -1,56 +1,60 @@ -#!/bin/sh +#! /bin/sh # -# $NetBSD: sasl_pwcheck.sh,v 1.1 2000/12/13 16:24:51 jlam Exp $ +# $NetBSD: sasl_pwcheck.sh,v 1.2 2001/11/21 22:22:10 jlam Exp $ # # The pwcheck daemon allows UNIX password authentication with Cyrus SASL. # # PROVIDE: sasl_pwcheck # REQUIRE: DAEMON +if [ -e /etc/rc.subr ] +then + . /etc/rc.subr +fi name="sasl_pwcheck" -command=@PREFIX@/sbin/pwcheck +rcvar="${name}" +command="@PREFIX@/sbin/pwcheck" command_args="& sleep 2" +extra_commands="dbinit" -pid=`ps -ax | awk '{print $1,$5}' | grep ${name} | awk '{print $1}'` +sasldb=@CONFDIR@/sasldb.db -cmd=${1:-start} - -case ${cmd} in -start) - if [ "$pid" = "" -a -x ${command} ] - then - echo "Starting ${name}." - ${command} ${command_args} - fi - ;; - -restart) - ( $0 stop ) - sleep 1 - $0 start - ;; - -stop) - if [ "$pid" != "" ] +sasl_pwcheck_dbinit() +{ + ( + saslpasswd=@PREFIX@/sbin/saslpasswd + umask 002 + if [ -e ${sasldb} ] then - echo "Stopping ${name}." - kill $pid + @ECHO@ "You already have an existing SASL password database" + @ECHO@ "Skipping empty database generation" + else + @ECHO@ password | ${saslpasswd} -p user + ${saslpasswd} -d user + @CHOWN@ @PKG_USER@ ${sasldb} + @CHMOD@ 0600 ${sasldb} fi - ;; + ) +} -status) - if [ "$pid" != "" ] +sasl_pwcheck_precmd() +{ + if [ ! -e ${sasldb} ] then - echo "${name} is running as pid ${pid}." - else - echo "${name} is not running." + @RCD_SCRIPTS_DIR@/sasl_pwcheck dbinit fi - ;; - -*) - echo 1>&2 "Usage: ${name} [restart|start|stop|status]" - exit 1 - ;; -esac -exit 0 +} + +dbinit_cmd=sasl_pwcheck_dbinit +start_precmd=sasl_pwcheck_precmd + +if [ -e /etc/rc.subr ] +then + load_rc_config $name + run_rc_command "$1" +else + @ECHO@ -n " ${name}" + start_precmd + ${command} ${sasl_pwcheck_flags} ${command_args} +fi |