c185e98150
both ports to the latest version. Also: - Set INVALID_BDB_VER [1] - Adopt new LIB_DEPENDS syntax [2] - Add option to support LMDB databases [2] - Modify shell command to quiet warnings on 10+ [3] - Respect upstream Makefile's warning suppression [4] PR: [1]: ports/185446 [2]: ports/185860 [3]: ports/185857 Submitted by: [1]: Eero Hanninen <fax@nohik.ee> [2]: Yasuhiro KIMURA <yasu@utahime.org> [3]: adamw [4]: koobs (via email)
100 lines
2.7 KiB
Bash
100 lines
2.7 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD: /tmp/pcvs/ports/mail/postfix/files/pkg-install.in,v 1.6 2012-02-11 05:14:34 sahil Exp $
|
|
#
|
|
|
|
# If the POSTFIX_DEFAULT_MTA environment variable is set to YES, it
|
|
# will make the port/package use defaults which make postfix replace
|
|
# sendmail as much as possible.
|
|
|
|
PREFIX=${PKG_PREFIX:=%%PREFIX%%}
|
|
ETCDIR=${ETCDIR:=%%ETCDIR%%}
|
|
DAEMONDIR=${DAEMONDIR:=%%DAEMONDIR%%}
|
|
READMEDIR=${READMEDIR:=%%READMEDIR%%}
|
|
BATCH=${BATCH:=no}
|
|
POSTFIX_DEFAULT_MTA=${POSTFIX_DEFAULT_MTA:=no}
|
|
MC=/etc/mail/mailer.conf
|
|
|
|
if [ "${POSTFIX_DEFAULT_MTA}" = "no" ]; then
|
|
DEFAULT_REPLACE_MAILERCONF=n
|
|
else
|
|
DEFAULT_REPLACE_MAILERCONF=y
|
|
fi
|
|
|
|
if [ -x /usr/sbin/nologin ]; then
|
|
NOLOGIN=/usr/sbin/nologin
|
|
else
|
|
NOLOGIN=/sbin/nologin
|
|
fi
|
|
|
|
ask() {
|
|
local question default answer
|
|
|
|
question=$1
|
|
default=$2
|
|
if [ -z "${PACKAGE_BUILDING}" -a "${BATCH}" = "no" ]; then
|
|
read -p "${question} [${default}]? " answer
|
|
fi
|
|
if [ -z "${answer}" ]; then
|
|
answer=${default}
|
|
fi
|
|
echo ${answer}
|
|
}
|
|
|
|
yesno() {
|
|
local question default answer
|
|
|
|
question=$1
|
|
default=$2
|
|
while :; do
|
|
answer=$(ask "${question}" "${default}")
|
|
case "${answer}" in
|
|
[Yy]*) return 0;;
|
|
[Nn]*) return 1;;
|
|
esac
|
|
echo "Please answer yes or no."
|
|
done
|
|
}
|
|
|
|
if [ "$2" = "POST-INSTALL" ]; then
|
|
SAMPLES="main.cf master.cf"
|
|
for file in $SAMPLES
|
|
do
|
|
if [ ! -f ${ETCDIR}/$file ]; then
|
|
cp ${DAEMONDIR}/$file ${ETCDIR}/
|
|
fi
|
|
done
|
|
|
|
cmp ${DAEMONDIR}/main.cf ${ETCDIR}/main.cf >/dev/null 2>&1 \
|
|
&& POSTARG="set-permissions" \
|
|
|| POSTARG="upgrade-package"
|
|
|
|
/bin/sh ${DAEMONDIR}/post-install tempdir=/tmp \
|
|
daemon_directory=${DAEMONDIR} \
|
|
html_directory=${READMEDIR} \
|
|
readme_directory=${READMEDIR} \
|
|
${POSTARG}
|
|
fi
|
|
|
|
if [ "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" -a -f "${MC}" ]; then
|
|
egrep -q "^sendmail.*${PREFIX}/sbin/sendmail" ${MC} && \
|
|
egrep -q "^send-mail.*${PREFIX}/sbin/sendmail" ${MC} && \
|
|
egrep -q "^mailq.*${PREFIX}/sbin/sendmail" ${MC} && \
|
|
egrep -q "^newaliases.*${PREFIX}/sbin/sendmail" ${MC}
|
|
ret=$?
|
|
if [ ${ret} -ne 0 ]; then
|
|
if yesno "Would you like to activate Postfix in ${MC}" ${DEFAULT_REPLACE_MAILERCONF}; then
|
|
/bin/mv -f ${MC} ${MC}.old
|
|
echo "#" > ${MC}
|
|
echo -n "# Execute the Postfix sendmail program" >> ${MC}
|
|
echo ", named ${PREFIX}/sbin/sendmail" >> ${MC}
|
|
echo "#" >> ${MC}
|
|
echo "sendmail ${PREFIX}/sbin/sendmail" >> ${MC}
|
|
echo "send-mail ${PREFIX}/sbin/sendmail" >> ${MC}
|
|
echo "mailq ${PREFIX}/sbin/sendmail" >> ${MC}
|
|
echo "newaliases ${PREFIX}/sbin/sendmail" >> ${MC}
|
|
fi
|
|
else
|
|
echo "Postfix already activated in ${MC}"
|
|
fi
|
|
fi
|