unitas-mail/app-backup/benno-web/benno-web-2.10.5.ebuild
2025-03-27 08:18:30 +01:00

106 lines
3.0 KiB
Bash

# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit tmpfiles
DESCRIPTION="Benno Mailarchive Web"
HOMEPAGE="https://www.benno-mailarchiv.de/"
SRC_URI="https://www.benno-mailarchiv.de/download/tgz/${P}.tgz"
S=${WORKDIR}
LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="amd64"
RESTRICT="mirror binchecks"
BDEPEND="
app-backup/benno-rest
dev-db/sqlite:3
dev-lang/php:*[apache2,curl,pdo,sqlite]
www-servers/apache
"
RDEPEND="
${BDEPEND}
dev-perl/Crypt-Eksblowfish
dev-perl/Crypt-Rijndael
dev-perl/DBD-SQLite
dev-perl/DBI
dev-perl/Data-Entropy
dev-perl/Data-Float
dev-perl/TermReadKey
dev-perl/perl-ldap
virtual/perl-Carp
virtual/perl-Digest-MD5
"
src_prepare() {
eapply_user
echo -n 'SHARED_SECRET = ' > etc/benno-web/rest.conf
if [ -f /etc/benno/rest.secret ];then
cat /etc/benno/rest.secret >> etc/benno-web/rest.conf
else
dd if=/dev/urandom bs=1k count=1 status=none | tr -dc a-zA-Z0-9 | head -c 20 >> etc/benno-web/rest.conf
fi
dd if=/dev/urandom bs=1k count=1 status=none | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1 > etc/benno-web/permalink.pass
echo "# benno_auth.d configuration file" >> etc/benno-web/auth.conf
echo "#" >> etc/benno-web/auth.conf
echo "module_dir=/etc/benno-web/auth.d" >> etc/benno-web/auth.conf
echo "" >> etc/benno-web/auth.conf
mkdir -p var/lib/benno-web
sqlite3 "var/lib/benno-web/bennoweb.sqlite" < usr/share/benno-web/db-create.sql 2>/dev/null
sqlite3 "var/lib/benno-web/bennoweb.sqlite" < usr/share/benno-web/db-update_2.0.1.sql 2>/dev/null
}
src_install() {
insinto /etc/benno-web
doins etc/benno-web/apache-2.4.conf etc/benno-web/benno.conf etc/benno-web/benno.conf.ex etc/benno-web/imapauth.conf etc/benno-web/ldapauth.conf
doins etc/benno-web/auth.conf etc/benno-web/rest.conf etc/benno-web/permalink.pass
fowners -R root:apache /etc/benno-web
fperms 0750 /etc/benno-web
fperms 0640 /etc/benno-web/benno.conf
exeinto /usr/lib/benno-web
doexe usr/lib/benno-web/*
## dosym /usr/lib/benno-web/benno_ldapauth /etc/benno-web/auth.d/40_benno_ldapauth
dosym /usr/lib/benno-web/benno_dbauth /etc/benno-web/auth.d/50_benno_dbauth
insinto /usr/share/
doins -r usr/share/benno-web
fperms 0755 /usr/share/benno-web/db-update_2.8.4.pl
fperms 0755 /usr/share/benno-web/db-update_2.10.3.pl
fperms 0755 /usr/share/benno-web/sendmail_mark
rm usr/sbin/benno-ptf
dosbin usr/sbin/*
insinto /var/lib/benno-web/
doins var/lib/benno-web/bennoweb.sqlite
fowners -R apache:apache /var/lib/benno-web
fperms 0750 /var/lib/benno-web
fperms 0660 /var/lib/benno-web/bennoweb.sqlite
insinto /srv/benno/bennoweb
doins -r srv/benno/bennoweb/htdocs
doins -r srv/benno/bennoweb/templates
newtmpfiles "${FILESDIR}/${PN}".tmpfilesd "${PN}".conf
dodoc usr/share/doc/benno-web/*
}
pkg_postinst() {
tmpfiles_process "${PN}.conf"
einfo "Please run database-updates after install and update:"
einfo " /usr/share/benno-web/db-update_2.8.4.pl"
einfo " /usr/share/benno-web/db-update_2.10.3.pl"
}