summaryrefslogtreecommitdiff
blob: 51ed5adac7fe54c9522860c3cfa35f76ee343903 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-mail/cyrus-imapd/cyrus-imapd-2.1.5.ebuild,v 1.2 2002/07/17 04:20:39 seemant Exp $

S=${WORKDIR}/${P}
DESCRIPTION="The Cyrus IMAP Server"
HOMEPAGE="http://asg.web.cmu.edu/cyrus/imapd/"
SRC_URI="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/${P}.tar.gz"

LICENSE="as-is"
SLOT="1"
KEYWORDS="x86"

PROVIDE="virtual/imapd"
RDEPEND="virtual/glibc
	afs? ( >=net-fs/open-afs-1.2.2 )
	snmp? ( >=net-analyzer/ucd-snmp-4.2.3 )
	ssl? ( >=dev-libs/openssl-0.9.6 )
	>=sys-libs/db-3.2
	>=sys-libs/pam-0.75
	>=dev-libs/cyrus-sasl-2.1.2
	>=sys-apps/tcp-wrappers-7.6"
DEPEND="virtual/glibc
	afs? ( >=net-fs/open-afs-1.2.2 )
	snmp? ( >=net-analyzer/ucd-snmp-4.2.3 )
	ssl? ( >=dev-libs/openssl-0.9.6 )
	>=sys-libs/db-3.2
	>=sys-libs/pam-0.75
	>=dev-libs/cyrus-sasl-2.1.2
	>=sys-apps/tcp-wrappers-7.6"


# recommended: flex, maybe: net-snmp, postfix, perl?, afs, inn, tcl (cyradm)
	
pkg_setup() {
	
	if ! grep -q ^cyrus: /etc/passwd ; then
		useradd -c cyrus -d /usr/cyrus -g mail -s /bin/false -u 96 cyrus \
			|| die "problem adding user cyrus"
	fi
}

src_unpack() {

	unpack ${A}
	cd ${WORKDIR}
	patch -p0 < ${FILESDIR}/e2fsprogs-et.diff
}

src_compile() {

	local myconf
	
	use afs || myconf="--without-afs"
	use snmp || myconf="${myconf} --without-ucdsnmp"
	use ssl || myconf="${myconf} --without-openssl"


	./configure \
		--prefix=/usr \
		--without-krb \
		--without-gssapi \
		--enable-listext \
		--disable-cyradm \
		--without-perl \
		--host=${CHOST} ${myconf} || die "bad ./configure"

	# make depends break with -f... in CFLAGS
	make depend CFLAGS="" || die "make depend problem"

	emake || die "compile problem"

}

src_install () {

	emake DESTDIR=${D} install || die

	# Remove the developer stuff (-> dev-libs/cyrus-imap-devel)
	rm -rf ${D}usr/include ${D}usr/lib

	# Remove the manpages (wrong place)
	rm -rf ${D}usr/man
	
	mkdir ${D}etc
	cp ${FILESDIR}/imapd.conf ${D}etc/imapd.conf
	cp ${FILESDIR}/cyrus.conf ${D}etc/cyrus.conf
	mkdir ${D}etc/pam.d
	cp ${FILESDIR}/pam.d-imap ${D}etc/pam.d/imap

	mkdir ${D}var ${D}var/log
	touch ${D}var/log/imapd.log
	touch ${D}var/log/auth.log

   	mkdir -m 0750 ${D}var/imap
   	chown -R cyrus.mail ${D}var/imap 
   	mkdir -m 0755 ${D}var/imap/db
        chown -R cyrus.mail ${D}var/imap/db
   	mkdir -m 0755 ${D}var/imap/log
        chown -R cyrus.mail ${D}var/imap/log
   	mkdir -m 0755 ${D}var/imap/msg
        chown -R cyrus.mail ${D}var/imap/msg
   	mkdir -m 0755 ${D}var/imap/user
        chown -R cyrus.mail ${D}var/imap/user
	for i in a b c d e f g h i j k l m n o p q r s t u v w x y z ; do mkdir -m 0755 ${D}var/imap/user/$i ; \
	    chown -R cyrus.mail ${D}var/imap/user/$i ; done
   	mkdir -m 0755 ${D}var/imap/proc
        chown -R cyrus.mail ${D}var/imap/proc
   	mkdir -m 0755 ${D}var/imap/quota
	for i in a b c d e f g h i j k l m n o p q r s t u v w x y z ; do mkdir -m 0755 ${D}var/imap/quota/$i ; \
	    chown -R cyrus.mail ${D}var/imap/quota/$i ; done
	mkdir -m 0755 ${D}var/imap/sieve
        chown -R cyrus.mail ${D}var/imap/sieve
	for i in a b c d e f g h i j k l m n o p q r s t u v w x y z ; do mkdir -m 0755 ${D}var/imap/sieve/$i ; \
	    chown -R cyrus.mail ${D}var/imap/sieve/$i ; done
   	mkdir -m 0755 ${D}var/imap/socket
        chown -R cyrus.mail ${D}var/imap/socket

	mkdir ${D}var/spool
	mkdir -m 0750 ${D}var/spool/imap
        chown -R cyrus.mail ${D}var/spool/imap
	mkdir -m 0755 ${D}var/spool/imap/stage.
        chown -R cyrus.mail ${D}var/spool/imap/stage.
	# For hashimapspool
	for i in a b c d e f g h i j k l m n o p q r s t u v w x y z ; do mkdir -m 0755 ${D}var/spool/imap/$i ; \
	    chown -R cyrus.mail ${D}var/spool/imap/$i ; done


	doman man/*.?
	# remove man-pages from packet net-mail/cyrus-imapd-admin
	rm ${D}usr/share/man/man1/installsieve.1.gz ${D}usr/share/man/man1/sieveshell.1.gz

	dodoc COPYRIGHT README*
	dohtml doc/*.html doc/murder.png
	cp doc/cyrusv2.mc ${D}usr/share/doc/${PF}/html
	
	cp -r contrib tools ${D}usr/share/doc/${PF}
	# Remove the CVS directories
	find 2>/dev/null ${D}usr/share/doc/ -type d -name CVS -exec rm -rf '{}' \;

	exeinto /etc/init.d ; newexe ${FILESDIR}/cyrus.rc6 cyrus

}

pkg_postinst() {

	ewarn "*****************************************************************"
	ewarn "* WARNING: If you change the fs-type of /var/imap or            *"
	ewarn "* /var/spool/imap you should read step 9 of                     *"
	ewarn "* /usr/share/doc/${P}/html/install-configure.html. *"
	if df -T /var/imap | grep -q ' ext[23] ' ; then
		ewarn "* Setting /var/imap/user/* and /var/imap/quota/* to synchronous *"
		ewarn "* updates.                                                      *"
		chattr +S /var/imap/user /var/imap/user/* /var/imap/quota /var/imap/quota/*
	fi
	if df -T /var/spool/imap | grep -q ' ext[23] ' ; then
		ewarn "* Setting /var/spool/imap/* to synchronous updates.             *"
		chattr +S /var/spool/imap /var/spool/imap/*
	fi
	ewarn "* If the queue directory of the mail daemon resides on an ext2  *"
	ewarn "* or ext3 partition you need to set it manually to update       *"
	ewarn "* synchronously. E.g. 'chattr +S /var/spool/mqueue'.            *"
	ewarn "*****************************************************************"

	einfo "*****************************************************************"
	einfo "* NOTE: For correct logging add                                 *"
	einfo "*         local6.* /var/log/imapd.log                           *"
	einfo "*         auth.debug /var/log/auth.log                          *"
	einfo "*       to /etc/sylog.conf.                                     *"
	einfo "*****************************************************************"

	if [ "'use ssl'" ]; then
		ewarn "*****************************************************************"
		ewarn "* WARNING: Read the section about SSL and TLS of                *"
		ewarn "* /usr/share/doc/${P}/html/install-configure.html. *"
		ewarn "* about installing the needed keys.                             *"
		ewarn "*****************************************************************"
	fi

	ewarn "*************************************************"
	ewarn "* WARNING: Add these services to /etc/services: *"
	ewarn "*            pop3   110/tcp                     *"
	ewarn "*            imap   143/tcp                     *"
	ewarn "*            imsp   406/tcp                     *"
	ewarn "*            acap   674/tcp                     *"
	ewarn "*            sieve  2000/tcp                    *"
	ewarn "*            lmtp   2003/tcp                    *"
	ewarn "*            fud    4201/udp                    *"
	ewarn "*************************************************"

}