3557e4ae46
config files and aliases. Bump PKGREVISION.
135 lines
3.4 KiB
Text
135 lines
3.4 KiB
Text
# $NetBSD: INSTALL,v 1.14 2018/12/04 17:01:39 schmonz Exp $
|
|
|
|
DOCDIR=@DOCDIR@
|
|
EGDIR=@EGDIR@
|
|
PKGMANDIR=@PKGMANDIR@
|
|
QMAILDIR=@QMAILDIR@
|
|
QMAIL_QUEUE_DIR=@QMAIL_QUEUE_DIR@
|
|
QMAIL_QUEUE_EXTRA=@QMAIL_QUEUE_EXTRA@
|
|
WC=@WC@
|
|
|
|
VAR_QMAIL_DIRS="alias bin boot control doc man queue users"
|
|
|
|
is_queue_fs_case_sensitive() {
|
|
cd ${QMAIL_QUEUE_DIR}
|
|
${MKDIR} pkgsrc
|
|
${TOUCH} pkgsrc/case-check pkgsrc/case-CHECK
|
|
count=$(${ECHO} pkgsrc/case-* | ${WC} -w)
|
|
${RM} -f pkgsrc/case-*
|
|
${RMDIR} pkgsrc
|
|
if [ ${count} -eq 2 ]; then
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
case ${STAGE} in
|
|
|
|
PRE-INSTALL)
|
|
for dir in $VAR_QMAIL_DIRS; do
|
|
if [ -e ${QMAILDIR}/$dir ]; then
|
|
${CAT} <<EOF
|
|
===========================================================================
|
|
|
|
ERROR: ${QMAILDIR} exists and is non-empty.
|
|
|
|
Please remove or rename it, then try again.
|
|
|
|
===========================================================================
|
|
EOF
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if ${ECHO} ${QMAIL_QUEUE_DIR} | ${GREP} -q "^${QMAILDIR}/"; then
|
|
${CAT} <<EOF
|
|
===========================================================================
|
|
|
|
ERROR: QMAIL_QUEUE_DIR must not be under ${QMAILDIR}.
|
|
|
|
Please adjust your definition of QMAIL_QUEUE_DIR, then try again.
|
|
|
|
===========================================================================
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
if ! is_queue_fs_case_sensitive; then
|
|
${CAT} <<EOF
|
|
===========================================================================
|
|
|
|
WARNING: QMAIL_QUEUE_DIR is on a case-insensitive filesystem.
|
|
|
|
===========================================================================
|
|
EOF
|
|
fi
|
|
|
|
# keep in sync with Makefile:pre-install
|
|
${LN} -s ${PKG_SYSCONFDIR}/alias ${QMAILDIR}/alias
|
|
${LN} -s ${PREFIX}/bin ${QMAILDIR}/bin
|
|
${LN} -s ${EGDIR}/boot ${QMAILDIR}/boot
|
|
${LN} -s ${PKG_SYSCONFDIR}/control ${QMAILDIR}/control
|
|
${LN} -s ${DOCDIR} ${QMAILDIR}/doc
|
|
${LN} -s ${PREFIX}/${PKGMANDIR} ${QMAILDIR}/man
|
|
${LN} -s ${QMAIL_QUEUE_DIR} ${QMAILDIR}/queue
|
|
${LN} -s ${PKG_SYSCONFDIR}/users ${QMAILDIR}/users
|
|
|
|
;;
|
|
|
|
POST-INSTALL)
|
|
${PREFIX}/share/qmail/setup/install-destdir
|
|
QMAIL_SETUP_EXITCODE=$?
|
|
if [ ${QMAIL_SETUP_EXITCODE} -ne 0 ]; then
|
|
${CAT} <<EOF
|
|
===========================================================================
|
|
|
|
ERROR: install-destdir exited nonzero (${QMAIL_SETUP_EXITCODE}).
|
|
|
|
Permissions are likely wrong, and/or the queue may be uninitialized.
|
|
|
|
===========================================================================
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
QMAIL_CHECK_OUTPUT=$(${PREFIX}/share/qmail/setup/instcheck 2>&1)
|
|
if [ -n "${QMAIL_CHECK_OUTPUT}" ]; then
|
|
${CAT} <<EOF
|
|
===========================================================================
|
|
|
|
ERROR: instcheck issued warnings:
|
|
|
|
${QMAIL_CHECK_OUTPUT}
|
|
|
|
Permissions are likely wrong, and/or the queue may be uninitialized.
|
|
|
|
===========================================================================
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
cd ${PREFIX}/share/qmail/setup && ./config-fast-pkgsrc `./hostname`
|
|
|
|
cd ${PKG_SYSCONFDIR}/.pkgsrc-defaults-do-not-edit
|
|
for i in locals rcpthosts; do
|
|
${SORT} -u ${i} > ${i}.tmp && ${MV} ${i}.tmp ${i}
|
|
done
|
|
|
|
cd ${PKG_SYSCONFDIR}
|
|
for i in defaultdomain locals me plusdomain rcpthosts; do
|
|
[ -f control/${i} ] \
|
|
|| ${CP} .pkgsrc-defaults-do-not-edit/${i} control
|
|
done
|
|
|
|
cd ${PKG_SYSCONFDIR}/alias
|
|
for i in mailer-daemon postmaster root ${QMAIL_QUEUE_EXTRA}; do
|
|
[ -s .qmail-${i} ] \
|
|
|| ${ECHO} '# pkgsrc says: replace this comment with your config' \
|
|
> .qmail-${i}
|
|
${CHMOD} 644 .qmail-${i}
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|