1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit systemd versionator user
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"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="ldap libressl sieve ssl static"
18 sieve? ( >=mail-filter/libsieve-2.2.1 )
19 ldap? ( >=net-nds/openldap-2.3.33 )
28 !libressl? ( dev-libs/openssl:0= )
29 libressl? ( dev-libs/libressl:0= )
35 enewuser dbmail -1 -1 /var/lib/dbmail dbmail
42 --sysconfdir=/etc/dbmail \
43 $(use_enable static) \
45 $(use_with ldap auth-ldap)
49 emake DESTDIR="${D}" SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" install
51 DOCS=( AUTHORS README.md INSTALL THANKS UPGRADING )
54 docompress -x /usr/share/doc/${PF}/sql
58 ## TODO: install other contrib stuff
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
65 newins dbmail.conf dbmail.conf.dist
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
80 dobin contrib/mailbox2dbmail/mailbox2dbmail
81 doman contrib/mailbox2dbmail/mailbox2dbmail.1
85 insinto /etc/openldap/schema
86 doins "${S}/dbmail.schema"
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)
94 #fowners dbmail:dbmail /run/dbmail
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."
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."
109 elog "For regular maintenance, add this to crontab:"
110 elog "0 3 * * * /usr/bin/dbmail-util -cpdy >/dev/null 2>&1"
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."
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)"
124 elog "Changed pid directory to /run/dbmail (see"
125 elog "http://www.dbmail.org/mantis/view.php?id=949 for details)"
127 ewarn "The database config has changed to support libzdb db URI"
128 ewarn "Please check the documentation (or Bug #479664)"
130 ewarn "The database schema has changed since 3.0.x make sure"
131 ewarn "to run the migration script"
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."