freebsd-ports/mail/qpopper/pkg-install
Mario Sergio Fujikawa Ferreira d494132719 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
2001-10-05 03:48:34 +00:00

53 lines
889 B
Bash

#!/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