summaryrefslogtreecommitdiff
path: root/mail/qmail/INSTALL
blob: 80dadac1ef99af37c5ecd9442de26b13ab680285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# $NetBSD: INSTALL,v 1.5 2011/06/07 02:53:42 schmonz Exp $

DOCDIR=@DOCDIR@
EGDIR=@EGDIR@
PKGMANDIR=@PKGMANDIR@
QMAILDIR=@QMAILDIR@
QMAIL_QUEUE_DIR=@QMAIL_QUEUE_DIR@
QMAIL_QUEUE_EXTRA=@QMAIL_QUEUE_EXTRA@
VIRUSCAN_SIGS_SRCFILE=@VIRUSCAN_SIGS_SRCFILE@

VAR_QMAIL_DIRS="alias bin boot control doc man queue users"

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

	# 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)
	if ! [ -z ${QMAIL_QUEUE_EXTRA} ]; then
		${CAT} <<EOF
===========================================================================

NOTE: Before using qmail, create a .qmail file corresponding with the local
user or alias "${QMAIL_QUEUE_EXTRA}" that meets the requirements for
QUEUE_EXTRA.

===========================================================================
EOF
	fi
	if ! [ -z ${VIRUSCAN_SIGS_SRCFILE} ] && \
		! [ -s ${PKG_SYSCONFDIR}/control/signatures ]; then
		${SED} -e '1,15d' -e '34,$d' \
			< ${VIRUSCAN_SIGS_SRCFILE} \
			> ${PKG_SYSCONFDIR}/control/signatures
		${CHMOD} 644 ${PKG_SYSCONFDIR}/control/signatures
	fi


	;;

esac