freebsd-ports/mail/relay-ctrl/pkg-install.in
Vanilla I. Shu af68d2bc66 * Fix pkg-install.in (thanks to Patrick Rinke)
* Add 'SIZE' to distinfo
* Bump version.

PR:		ports/64655
Submitted by:	maintainer
2004-03-24 19:57:02 +00:00

63 lines
1.2 KiB
Bash

#!/bin/sh
[ $# != 2 ] && exit 1
PKGNAME=$1
ACTION=$2
CHMOD=/bin/chmod
ECHO_CMD=echo
RM='/bin/rm -rf'
CP='/bin/cp -p'
CMP='/usr/bin/cmp -s'
MKDIR='/bin/mkdir -p'
RELAYCTRL_EXPIRY=600
PREFIX=${PKG_PREFIX}
SPOOLDIR=/var/spool
ETCDIR=${PREFIX}/etc/relay-ctrl
RELAYCLIENT=${ETCDIR}/RELAY_CTRL_RELAYCLIENT
EXPIRY=${ETCDIR}/RELAY_CTRL_EXPIRY
case "$ACTION" in
POST-INSTALL)
${MKDIR} ${ETCDIR} ${SPOOLDIR}/relay-ctrl/allow
${CHMOD} 0700 ${SPOOLDIR}/relay-ctrl
${CHMOD} 0777 ${SPOOLDIR}/relay-ctrl/allow
${ECHO_CMD} "${SPOOLDIR}/relay-ctrl/allow" > ${ETCDIR}/RELAY_CTRL_DIR
${ECHO_CMD} "%%EXPIRY%%" > ${EXPIRY}
if [ -z "%%FIXUP%%" ]; then
${ECHO_CMD} "===> RELAY-CTRL: Script do not create RELAY_CTRL_RELAYCLIENT"
else
if [ -e "${RELAYCLIENT}" ]; then
${ECHO_CMD} ":allow,RELAYCLIENT='%%FIXUP%%'" > ${RELAYCLIENT}-sample
else
${ECHO_CMD} ":allow,RELAYCLIENT='%%FIXUP%%'" > ${RELAYCLIENT}
${CP} ${RELAYCLIENT} ${RELAYCLIENT}-dist
fi
fi
;;
DEINSTALL)
${RM} ${SPOOLDIR}/relay-ctrl
if ${CMP} ${RELAYCLIENT} ${RELAYCLIENT}-dist; then \
${RM} ${RELAYCLIENT}
fi
if [ -e ${RELAYCLIENT}-dist ]; then
${RM} ${RELAYCLIENT}-dist
else
${RM} ${RELAYCLIENT}-sample
fi
;;
PRE-INSTALL|POST-DEINSTALL)
;;
*)
exit 1
;;
esac
exit