diff options
author | lioux <lioux@FreeBSD.org> | 2001-10-05 03:48:34 +0000 |
---|---|---|
committer | lioux <lioux@FreeBSD.org> | 2001-10-05 03:48:34 +0000 |
commit | bb86b39b457c2955b4a29cae0360c127fcb62208 (patch) | |
tree | 2f8bafd022327bde70a4add7a15ca2abb6483bd8 | |
parent | 75b8944b8cae546546a30c9034b5fc1c57ffe50f (diff) | |
download | FreeBSD-ports-bb86b39b457c2955b4a29cae0360c127fcb62208.zip FreeBSD-ports-bb86b39b457c2955b4a29cae0360c127fcb62208.tar.gz |
1) instead of "stealthly" installing a file with a user list that
cannot log in the popper daemon, let the users decide for either
a default file (use a copy of the system's /etc/ftpusers file)
or an empty file
2) also, make the installation of this file prefix safe and name
it popusers (PREFIX/etc/qpopper/popusers). This changes expected
behavior of the port
3) add a PKGINSTALL script to handle this file install/deinstall
4) style changes: use variables to make the port easier to maintain
Prompted by: Dan Langille <dan@langille.org>
Reviewed by: freebsd-ports (silence), kris, sobomax
-rw-r--r-- | mail/qpopper/Makefile | 42 | ||||
-rw-r--r-- | mail/qpopper/pkg-install | 53 | ||||
-rw-r--r-- | mail/qpopper/pkg-plist | 6 |
3 files changed, 95 insertions, 6 deletions
diff --git a/mail/qpopper/Makefile b/mail/qpopper/Makefile index bb6c2b2..b9bd9c8 100644 --- a/mail/qpopper/Makefile +++ b/mail/qpopper/Makefile @@ -29,15 +29,29 @@ GNU_CONFIGURE= yes CONFIGURE_ENV= LIBS="-lmd -lutil" \ OS_DEFS="-DSETPROCTITLE ${OS_DEFS}" CONFIGURE_ARGS= --enable-apop=${PREFIX}/etc/qpopper/pop.auth \ - --enable-nonauth-file=/etc/ftpusers \ + --enable-nonauth-file=${POPUSERS_FILE} \ --with-apopuid=pop --without-gdbm \ --enable-keep-temp-drop -PLIST_SUB= EPOPPASSD=${EPOPPASSD} +PLIST_SUB= EPOPPASSD=${EPOPPASSD} \ + POP_USER=${POP_USER} \ + POP_GROUP=${POP_GROUP} \ + POP_MODE_DIR=${POP_MODE_DIR} \ + POP_MODE_CONF=${POP_MODE_CONF} MAN8= qpopauth.8 qpopper.8 -pre-fetch: +# internal configuration +POP_USER= pop +POP_GROUP= daemon +POP_MODE_DIR= 0711 +POP_MODE_CONF= 0444 +POPUSERS_FILE= ${PREFIX}/etc/qpopper/popusers +SAMPLE_EXT= .sample +# +PKGDEINSTALL= ${PKGINSTALL} + +pre-everything:: .if defined(APOP_ONLY) @${ECHO_MSG} "==> The APOP_ONLY option is deprecated, please use" @${ECHO_MSG} " WITH_APOP_ONLY instead." @@ -56,6 +70,8 @@ pre-fetch: @${ECHO_MSG} "WITH_APOP_ONLY=yes builds with APOP authentication only" @${ECHO_MSG} "WITH_FULL_POPD_DEBUG=yes buils with more verbose debugging" @${ECHO_MSG} "WITH_POPPASSD=yes builds the poppassd daemon" + @${ECHO_MSG} "WITH_SAMPLE_POPUSERS_FILE=yes builds a default (otherwise," + @${ECHO_MSG} " use an empty file) reject file" # If WITH_APOP_ONLY variable present in the environment, qpopper builds # with APOP authentication only. @@ -111,8 +127,26 @@ do-install: .if defined(WITH_POPPASSD) ${INSTALL_PROGRAM} ${WRKSRC}/password/poppassd ${PREFIX}/libexec/qpoppassd .endif + @${INSTALL} -d -o ${POP_USER} -g ${POP_GROUP} -m ${POP_MODE_DIR} \ + ${PREFIX}/etc/${PORTNAME} -post-install: +post-install: install-conf-file @${SED} -e "s:/usr/local:${PREFIX}:g" ${PKGMESSAGE} +# based on original from op port, written by Cyrille Lefevre +# <clefevre@citeweb.net> +install-conf-file: + @if [ ! -f ${CONF_DIR}/${CONF_FILE}${SAMP_SUFX} ]; then \ + if [ -f /etc/ftpusers ] && [ -n "${WITH_SAMPLE_POPUSERS_FILE}" ]; then \ + ${INSTALL} -c -o ${POP_USER} -g ${POP_GROUP} -m ${POP_MODE_CONF} \ + /etc/ftpusers ${POPUSERS_FILE}${SAMPLE_EXT} ; \ + else \ + ${CP} /dev/null ${POPUSERS_FILE}${SAMPLE_EXT} ; \ + ${CHOWN} ${POP_USER}:${POP_GROUP} ${POPUSERS_FILE}${SAMPLE_EXT} ; \ + ${CHMOD} ${POP_MODE_CONF} ${POPUSERS_FILE}${SAMPLE_EXT} ; \ + fi ; \ + fi + @${SETENV} PKG_PREFIX=${PREFIX} ${SH} \ + ${PKGINSTALL} ${PKGNAME} POST-INSTALL + .include <bsd.port.post.mk> diff --git a/mail/qpopper/pkg-install b/mail/qpopper/pkg-install new file mode 100644 index 0000000..838c114 --- /dev/null +++ b/mail/qpopper/pkg-install @@ -0,0 +1,53 @@ +#!/bin/sh +# $FreeBSD$ + +# based on original from op port, written by Cyrille Lefevre +# <clefevre@citeweb.net> + +[ $# != 2 ] && exit 1 +PKGNAME=$1 +ACTION=$2 + +CONF_DIR=${PKG_PREFIX}/etc/qpopper + +CONF_FILE=popusers +CONF_OWN=pop +CONF_GRP=daemon +CONF_MODE=444 + +SAMP_SUFX=.sample + +INSTALL=install +CMP=cmp +RM=rm + +case "$ACTION" in + +POST-INSTALL) + if [ -f ${CONF_DIR}/${CONF_FILE} ]; then + echo "$PKGNAME: Will not overwrite existing ${CONF_DIR}/${CONF_FILE} file." + else + ${INSTALL} -c -o ${CONF_OWN} -g ${CONF_GRP} -m ${CONF_MODE} \ + ${CONF_DIR}/${CONF_FILE}${SAMP_SUFX} \ + ${CONF_DIR}/${CONF_FILE} + fi + ;; + +DEINSTALL) + if ${CMP} -s ${CONF_DIR}/${CONF_FILE}${SAMP_SUFX} \ + ${CONF_DIR}/${CONF_FILE}; then + ${RM} -f ${CONF_DIR}/${CONF_FILE} + else + echo "$PKGNAME: Will not remove existing ${CONF_DIR}/${CONF_FILE} file." + fi + ;; + +PRE-INSTALL|POST-DEINSTALL) + ;; + +*) + exit 1 + ;; +esac + +exit diff --git a/mail/qpopper/pkg-plist b/mail/qpopper/pkg-plist index 40479a1..166f96c 100644 --- a/mail/qpopper/pkg-plist +++ b/mail/qpopper/pkg-plist @@ -3,5 +3,7 @@ bin/qpopauth @exec ln -sf %D/bin/qpopauth %D/bin/qapopauth libexec/qpopper %%EPOPPASSD%%libexec/qpoppassd -@dirrm etc/qpopper -@exec mkdir -p %D/etc/qpopper && chown pop:daemon %D/etc/qpopper && chmod 700 %D/etc/qpopper +@exec mkdir -p %D/etc/qpopper && chown %%POP_USER%%:%%POP_GROUP%% %D/etc/qpopper && chmod %%POP_MODE_DIR%% %D/etc/qpopper +@mode %%POP_MODE_CONF%% +etc/qpopper/popusers.sample +@unexec rmdir %D/etc/qpopper 2>/dev/null || echo "If you are permanently removing this port, you should do a ``rm -rf ${PKG_PREFIX}/etc/qpopper`` to remove any configuration files and logs left." | fmt |