1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-22 20:41:26 +00:00

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
This commit is contained in:
Mario Sergio Fujikawa Ferreira 2001-10-05 03:48:34 +00:00
parent 89d58bf2f4
commit d494132719
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=48451
3 changed files with 95 additions and 6 deletions

View File

@ -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>

53
mail/qpopper/pkg-install Normal file
View File

@ -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

View File

@ -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