108 lines
2.5 KiB
Bash
108 lines
2.5 KiB
Bash
# Copyright 1999-2019 Gentoo Foundation
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
EAPI=7
|
|
|
|
MY_PN="${PN/-bin}"
|
|
MY_P=${MY_PN}-${PV}
|
|
|
|
DESCRIPTION="All-in-one Mail & Collaboration server"
|
|
HOMEPAGE="https://stalw.art"
|
|
|
|
SRC_URI="
|
|
amd64? ( https://github.com/stalwartlabs/stalwart/releases/download/v${PV}/stalwart-x86_64-unknown-linux-gnu.tar.gz )
|
|
"
|
|
RESTRICT="mirror strip bindist"
|
|
|
|
LICENSE="GPL-3"
|
|
SLOT="0"
|
|
KEYWORDS="~amd64"
|
|
|
|
DEPEND="
|
|
acct-user/stalwart-mail
|
|
acct-group/stalwart-mail
|
|
"
|
|
S="${WORKDIR}"
|
|
RDEPEND="
|
|
${DEPEND}
|
|
"
|
|
|
|
DOCS=( )
|
|
|
|
QA_PRESTRIPPED="/usr/bin/stalwart"
|
|
QA_SONAME="/usr/bin/stalwart"
|
|
|
|
src_install(){
|
|
dobin stalwart
|
|
# -- setting NET-BIND
|
|
SETCAP="setcap cap_net_bind_service=+ep"
|
|
${SETCAP} "${D}/usr/bin/stalwart"
|
|
newinitd ${FILESDIR}/initd stalwartd
|
|
|
|
for d in /var/log/stalwart /etc/stalwart /var/lib/stalwart
|
|
do
|
|
keepdir ${d}
|
|
chown stalwart-mail:stalwart-mail ${D}/${d}
|
|
chmod 0750 ${D}/${d}
|
|
done
|
|
|
|
_env="stalwart.confd"
|
|
write_env_file ${_env}
|
|
newconfd ${_env} stalwartd
|
|
chmod 0640 ${D}/etc/conf.d/stalwartd
|
|
|
|
mkdir ${D}/etc/logrotate.d
|
|
write_log_rotate ${D}/etc/logrotate.d/stalwart
|
|
}
|
|
|
|
write_env_file() {
|
|
cat > "$1" <<'EOF'
|
|
# Environment variables for the Stalwart service.
|
|
# Uncomment and edit an entry to override its default.
|
|
|
|
# Override the hostname used in HTTP responses
|
|
#STALWART_HOSTNAME=mail.example.com
|
|
|
|
# Override the public base URL published in OAuth, OIDC, and JMAP discovery
|
|
# documents. Accepts scheme, host and optional port; serving Stalwart under a
|
|
# path prefix is not supported.
|
|
#STALWART_PUBLIC_URL=https://mail.example.com
|
|
|
|
# Enable bootstrap / recovery mode on startup. Accepted: 1, true. Default: false.
|
|
#STALWART_RECOVERY_MODE=true
|
|
|
|
# Log level while in recovery mode. Default: info.
|
|
#STALWART_RECOVERY_MODE_LOG_LEVEL=debug
|
|
|
|
# HTTP port used in recovery mode. Default: 8080.
|
|
#STALWART_RECOVERY_MODE_PORT=9090
|
|
|
|
# Fixed administrator credentials — format: username:password
|
|
# Default: a temporary random password is generated and printed to the logs.
|
|
#STALWART_RECOVERY_ADMIN=admin:changeme
|
|
|
|
# Cluster role assigned to this node. Must match a role name defined in the
|
|
# cluster registry. Leave unset for a standalone (non-clustered) deployment.
|
|
#STALWART_ROLE=primary
|
|
|
|
# Push-notification shard this node is responsible for, when running in a
|
|
# cluster.
|
|
#STALWART_PUSH_SHARD=1
|
|
EOF
|
|
}
|
|
|
|
write_log_rotate() {
|
|
cat > "$1" <<'EOF'
|
|
/var/log/stalwart/stalwart.log {
|
|
su stalwart-mail stalwart-mail
|
|
weekly
|
|
rotate 4
|
|
compress
|
|
delaycompress
|
|
missingok
|
|
notifempty
|
|
copytruncate
|
|
}
|
|
EOF
|
|
}
|