app-metrics/prometheus: add 3.1.0
[gentoo/gentoo.git] / www-apps / postfixadmin / postfixadmin-3.3.13.ebuild
blob161078f4e21270a9105eb58db9184cfc489f68a7
1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit webapp
8 DESCRIPTION="Web Based Management tool for Postfix style virtual domains and users"
9 HOMEPAGE="http://postfixadmin.sourceforge.net"
10 SRC_URI="https://github.com/postfixadmin/postfixadmin/archive/${P}.tar.gz"
11 S="${WORKDIR}/${PN}-${P}"
13 LICENSE="GPL-2"
14 KEYWORDS="amd64 ~ppc x86"
15 IUSE="+mysql postgres +vacation"
16 REQUIRED_USE="|| ( mysql postgres )"
18 DEPEND="
19         dev-lang/php:*[unicode,imap,postgres?]
20         vacation? (
21                 acct-group/vacation
22                 acct-user/vacation
23                 dev-perl/DBI
24                 dev-perl/Email-Sender
25                 dev-perl/Email-Valid
26                 dev-perl/Log-Dispatch
27                 dev-perl/Log-Log4perl
28                 dev-perl/MIME-Charset
29                 dev-perl/MIME-EncWords
30                 mysql? ( dev-perl/DBD-mysql )
31                 postgres? ( dev-perl/DBD-Pg )
32         )
35 RDEPEND="
36         ${DEPEND}
37         virtual/httpd-php
38         mysql? ( || ( dev-lang/php[mysqli] dev-lang/php[mysql] ) )
41 need_httpd_cgi
43 pkg_setup() {
44         webapp_pkg_setup
47 src_install() {
48         webapp_src_preinst
50         if use vacation; then
51                 insinto /var/spool/vacation
52                 newins VIRTUAL_VACATION/vacation.pl vacation.pl-${SLOT}
53                 fperms 755 /var/spool/vacation/vacation.pl-${SLOT}
54                 dodoc VIRTUAL_VACATION/FILTER_README
55                 newdoc VIRTUAL_VACATION/INSTALL.md VIRTUAL_VACATION_INSTALL.md
56                 rm -r VIRTUAL_VACATION/{vacation.pl,INSTALL.md,tests,FILTER_README} || die
57         fi
59         dodoc -r ADDITIONS
61         local docs="DOCUMENTS/*.txt INSTALL.TXT CHANGELOG.TXT"
62         dodoc ${docs}
64         rm -rf ${docs} DOCUMENTS/ GPL-LICENSE.TXT LICENSE.TXT debian/ tests/ ADDITIONS/
66         insinto "${MY_HTDOCSDIR}"
67         doins -r .
69         webapp_configfile "${MY_HTDOCSDIR}"/config.inc.php
71         webapp_postinst_txt en "${FILESDIR}"/postinstall-en-2.3.txt
72         webapp_src_install
75 pkg_postinst() {
76         webapp_pkg_postinst
78         einfo "Please note that if upgrading from version prior to 3.3.0,"
79         einfo "existing setup_password will no longer work and you will"
80         einfo "need to generate new one. See instructions in setup.php."
82         if use vacation; then
83                 # portage does not update owners of directories (feature :)
84                 chown vacation:vacation "${ROOT}"/var/spool/vacation/
85                 einfo
86                 einfo "/var/spool/vacation/vacation.pl symlink was updated to:"
87                 einfo "/var/spool/vacation/vacation.pl-${SLOT}"
88                 ln -sf "${ROOT}"/var/spool/vacation/vacation.pl{-${SLOT},} || die
89         fi
92 pkg_postrm() {
93         # Make sure we don't leave broken vacation.pl symlink
94         find -L "${ROOT}"/var/spool/vacation/ -type l -delete
95         local shopt_save=$(shopt -p nullglob)
96         shopt -s nullglob
97         local vacation=( "${ROOT}"/var/spool/vacation/vacation.pl-* )
98         ${shopt_save}
99         if [[ ! -e "${ROOT}"/var/spool/vacation/vacation.pl && -n ${vacation[@]} ]]; then
100                 ln -s "${vacation[-1]}" "${ROOT}"/var/spool/vacation/vacation.pl || die
101                 ewarn "/var/spool/vacation/vacation.pl was updated to point on most"
102                 ewarn "recent verion, but please, do your own checks"
103         fi