summaryrefslogtreecommitdiff
path: root/mail/qmail/INSTALL
blob: 89b4a5dcd66b5a05759f14f01258a49a9d41e3b4 (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
80
81
82
83
84
85
86
87
88
# $NetBSD: INSTALL,v 1.6 2014/05/30 21:35:04 schmonz Exp $

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

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

	SERVERCERT=${PKG_SYSCONFDIR}/control/servercert.pem
	if ! [ -z ${OPENSSL} ] && ! [ -s ${SERVERCERT} ]; then
		${CAT} <<EOF
===========================================================================

NOTE: If you don't already have an SSL certificate for qmail:

# ${OPENSSL} req -new -x509 -nodes -days 366 -out ${SERVERCERT} -keyout ${SERVERCERT}
# chmod 640 ${SERVERCERT}
# chown qmaild:qmail ${SERVERCERT}
# ln -s ${SERVERCERT} ${PKG_SYSCONFDIR}/control/clientcert.pem
# update_tmprsadh

===========================================================================
EOF
	fi

	;;

esac