79 lines
1.6 KiB
Bash
79 lines
1.6 KiB
Bash
# Copyright 1999-2024 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
EAPI=8
|
|
|
|
inherit systemd tmpfiles
|
|
|
|
DESCRIPTION="Benno Mailarchive Rest"
|
|
HOMEPAGE="https://www.benno-mailarchiv.de/"
|
|
SRC_URI="https://www.benno-mailarchiv.de/download/tgz/${P}.tgz"
|
|
S=${WORKDIR}
|
|
|
|
LICENSE="Benno"
|
|
SLOT="0"
|
|
KEYWORDS="amd64"
|
|
|
|
RESTRICT="mirror binchecks"
|
|
|
|
BDEPEND="
|
|
acct-group/benno
|
|
acct-user/bennorest
|
|
app-backup/benno-rest-lib
|
|
"
|
|
RDEPEND="
|
|
${BDEPEND}
|
|
dev-perl/JSON
|
|
dev-perl/libwww-perl
|
|
virtual/perl-MIME-Base64
|
|
"
|
|
|
|
INSTALL_DIR=/opt/benno
|
|
|
|
src_prepare() {
|
|
eapply_user
|
|
|
|
if [ -f /etc/benno-web/rest.conf ];then
|
|
cat /etc/benno-web/rest.conf | grep ^SHARED_SECRET |perl -pe 's/^.+=\s*//' >> etc/benno/rest.secret
|
|
else
|
|
dd if=/dev/urandom bs=1k count=1 status=none | tr -dc a-zA-Z0-9 | head -c 20 > etc/benno/rest.secret
|
|
fi
|
|
}
|
|
|
|
src_install() {
|
|
keepdir /var/log/benno
|
|
fowners benno:benno /var/log/benno
|
|
fperms 0770 /var/log/benno
|
|
|
|
systemd_dounit lib/systemd/system/benno-rest.service
|
|
|
|
newtmpfiles "${FILESDIR}/${PN}".tmpfilesd "${PN}".conf
|
|
|
|
dodir "${INSTALL_DIR}"
|
|
cp -a "${S}"/${INSTALL_DIR}/bennorest.jar "${ED}${INSTALL_DIR}" || die
|
|
fowners -R benno:benno "${INSTALL_DIR}"
|
|
|
|
insinto /etc/default
|
|
doins etc/default/benno-rest
|
|
|
|
insinto /etc/benno
|
|
doins etc/benno/jetty.xml
|
|
doins etc/benno/rest-log4j.xml
|
|
fowners -R root:benno /etc/benno
|
|
fperms 0750 /etc/benno
|
|
doins etc/benno/rest.secret
|
|
fowners benno:benno /etc/benno/rest.secret
|
|
fperms 0640 /etc/benno/rest.secret
|
|
|
|
insinto /etc/benno-web
|
|
|
|
dosbin usr/sbin/benno-report
|
|
|
|
exeinto /etc/cron.weekly
|
|
doexe etc/cron.weekly/benno-rest
|
|
}
|
|
|
|
pkg_postinst() {
|
|
tmpfiles_process "${PN}.conf"
|
|
}
|