net-mail/fetchmail: 6.4.3 bump
[gentoo.git] / net-mail / dbmail / dbmail-3.2.3-r2.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit systemd versionator user
7
8 DESCRIPTION="Fast and scalable sql based email services"
9 HOMEPAGE="http://www.dbmail.org/"
10 SRC_URI="http://www.dbmail.org/download/$(get_version_component_range 1-2)/${P}.tar.gz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="ldap libressl sieve ssl static"
16
17 DEPEND="dev-db/libzdb
18         sieve? ( >=mail-filter/libsieve-2.2.1 )
19         ldap? ( >=net-nds/openldap-2.3.33 )
20         app-text/asciidoc
21         app-text/xmlto
22         app-crypt/mhash
23         sys-libs/zlib
24         dev-libs/gmime:2.6
25         >=dev-libs/glib-2.16
26         dev-libs/libevent
27         ssl? (
28                 !libressl? ( dev-libs/openssl:0= )
29                 libressl? ( dev-libs/libressl:0= )
30         )"
31 RDEPEND="${DEPEND}"
32
33 pkg_setup() {
34         enewgroup dbmail
35         enewuser dbmail -1 -1 /var/lib/dbmail dbmail
36 }
37
38 src_configure() {
39         econf \
40                 --enable-manpages \
41                 --enable-systemd \
42                 --sysconfdir=/etc/dbmail \
43                 $(use_enable static) \
44                 $(use_with sieve) \
45                 $(use_with ldap auth-ldap)
46 }
47
48 src_install() {
49         emake DESTDIR="${D}" SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" install
50
51         DOCS=( AUTHORS README.md INSTALL THANKS UPGRADING )
52         einstalldocs
53
54         docompress -x /usr/share/doc/${PF}/sql
55         dodoc -r sql
56         dodoc -r test-scripts
57         dodoc -r contrib
58         ## TODO: install other contrib stuff
59
60         sed -i -e "s:nobody:dbmail:" dbmail.conf || die
61         sed -i -e "s:nogroup:dbmail:" dbmail.conf || die
62         sed -i -e "s:/var/run:/run/dbmail:" dbmail.conf || die
63
64         insinto /etc/dbmail
65         newins dbmail.conf dbmail.conf.dist
66
67         # change config path to our default and use the conf.d and init.d files from the contrib dir
68         sed -i -e "s:/etc/dbmail.conf:/etc/dbmail/dbmail.conf:" contrib/startup-scripts/gentoo/init.d-dbmail || die
69         #sed -i -e "s:exit 0:return 1:" contrib/startup-scripts/gentoo/init.d-dbmail || die
70         #sed -i -e "s:/var/run:/var/run/dbmail:" contrib/startup-scripts/gentoo/init.d-dbmail || die
71         #newconfd contrib/startup-scripts/gentoo/conf.d-dbmail dbmail
72         #newinitd contrib/startup-scripts/gentoo/init.d-dbmail dbmail
73         # use custom init scripts until updated in upstream contrib
74         newinitd "${FILESDIR}/dbmail-imapd.initd" dbmail-imapd
75         newinitd "${FILESDIR}/dbmail-lmtpd.initd" dbmail-lmtpd
76         newinitd "${FILESDIR}/dbmail-pop3d.initd" dbmail-pop3d
77         newinitd "${FILESDIR}/dbmail-timsieved.initd" dbmail-timsieved
78         sed -i -e "s:/var/run:/run:" "${D}"/etc/init.d/dbmail-* || die
79
80         dobin contrib/mailbox2dbmail/mailbox2dbmail
81         doman contrib/mailbox2dbmail/mailbox2dbmail.1
82
83         # ldap schema
84         if use ldap; then
85                 insinto /etc/openldap/schema
86                 doins "${S}/dbmail.schema"
87         fi
88
89         keepdir /var/lib/dbmail
90         fperms 750 /var/lib/dbmail
91         fowners dbmail:dbmail /var/lib/dbmail
92         # create this through init-scripts instead of at install time (bug #455002)
93         #keepdir /run/dbmail
94         #fowners dbmail:dbmail /run/dbmail
95 }
96
97 pkg_postinst() {
98         elog "Please read the INSTALL file in /usr/share/doc/${PF}/"
99         elog "for remaining instructions on setting up dbmail users and "
100         elog "for finishing configuration to connect to your MTA and "
101         elog "to connect to your db."
102         echo
103         elog "DBMail requires either SQLite, PostgreSQL or MySQL."
104         elog "Database schemes can be found in /usr/share/doc/${PF}/"
105         elog "You will also want to follow the installation instructions"
106         elog "on setting up the maintenance program to delete old messages."
107         elog "Don't forget to edit /etc/dbmail/dbmail.conf as well."
108         echo
109         elog "For regular maintenance, add this to crontab:"
110         elog "0 3 * * * /usr/bin/dbmail-util -cpdy >/dev/null 2>&1"
111         echo
112         elog "Please make sure to run etc-update."
113         elog "If you get an error message about plugins not found"
114         elog "please add the library_directory configuration switch to"
115         elog "dbmail.conf and set it to the correct path"
116         elog "(usually /usr/lib/dbmail or /usr/lib64/dbmail on amd64)"
117         elog "A sample can be found in dbmail.conf.dist after etc-update."
118         echo
119         elog "We are now using the init script from upstream."
120         elog "Please edit /etc/conf.d/dbmail to set which services to start"
121         elog "and delete /etc/init.d/dbmail-* when you are done. (don't"
122         elog "forget to rc-update del dbmail-* first)"
123         echo
124         elog "Changed pid directory to /run/dbmail (see"
125         elog "http://www.dbmail.org/mantis/view.php?id=949 for details)"
126         echo
127         ewarn "The database config has changed to support libzdb db URI"
128         ewarn "Please check the documentation (or Bug #479664)"
129         echo
130         ewarn "The database schema has changed since 3.0.x make sure"
131         ewarn "to run the migration script"
132         echo
133         ewarn "Please be aware, that the single init-script for all services"
134         ewarn "has been replaced with seperate init scripts for the individual services."
135         ewarn "Make sure to add dbmail-(imapd|lmtpd|pop3d|timsieved) using rc-update"
136         ewarn "and remove dbmail if you want to take advantage of this change."
137         echo
138 }