diff --git a/net-mail/stalwart-bin/Manifest b/net-mail/stalwart-bin/Manifest new file mode 100644 index 0000000..8577480 --- /dev/null +++ b/net-mail/stalwart-bin/Manifest @@ -0,0 +1 @@ +DIST stalwart-x86_64-unknown-linux-gnu.tar.gz 53755802 BLAKE2B 493325d1fb71d96ba7c5e670b7c622a1e267061e8c20e94ebf0d7b2a1fb4d07e6f7c985131b599f22ba0acfde5a11cad83f9adffdaf8bf52a7076b64eb0869a0 SHA512 5aaf4d533330e3c1ab440a54cea6c8b8b34d8d89c39ae17716597b39545bcbd5f07140644d680ba83b448ea6d9d335eb14f0bd35912b0896d1084b20c6f9387b diff --git a/net-mail/stalwart-bin/files/initd b/net-mail/stalwart-bin/files/initd new file mode 100644 index 0000000..d3bc632 --- /dev/null +++ b/net-mail/stalwart-bin/files/initd @@ -0,0 +1,34 @@ +#!/sbin/openrc-run +# Copyright 2007-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +_user=stalwart-mail + +command=${RC_PREFIX}/usr/bin/stalwart +pidfile=${RC_PREFIX}/var/run/stalwart/pid +error_log="/var/log/stalwart/stalwart${RC_PREFIX}.log" +command_args="--config /etc/stalwart/config.toml" +command_user="${_user}:${_user}" +command_background="yes" +name="Stalwart mail server" + +[ -z "$STALWART_HOSTNAME:" ] && export STALWART_HOSTNAME="$STALWART_HOSTNAME" +[ -z "$STALWART_PUBLIC_URL:" ] && export STALWART_PUBLIC_URL="$STALWART_PUBLIC_URL" +[ -z "$STALWART_RECOVERY_MODE:" ] && export STALWART_RECOVERY_MODE="$STALWART_RECOVERY_MODE" +[ -z "$STALWART_RECOVERY_MODE_LOG_LEVEL:" ] && export STALWART_RECOVERY_MODE_LOG_LEVEL="$STALWART_RECOVERY_MODE_LOG_LEVEL" +[ -z "$STALWART_RECOVERY_MODE_PORT:" ] && export STALWART_RECOVERY_MODE_PORT="$STALWART_RECOVERY_MODE_PORT" +[ -z "$STALWART_RECOVERY_ADMIN:" ] && export STALWART_RECOVERY_ADMIN="$STALWART_RECOVERY_ADMIN" +[ -z "$STALWART_ROLE:" ] && export STALWART_ROLE="$STALWART_ROLE" +[ -z "$STALWART_PUSH_SHARD:" ] && export STALWART_PUSH_SHARD="$STALWART_PUSH_SHARD" + +depend() +{ + need net + use postgresql mysql + before provide mta +} + +start_pre() +{ + checkpath -d -m 0755 -o ${_user}:${_user} `dirname ${pidfile}` +} diff --git a/net-mail/stalwart-bin/stalwart-bin-1.1.0.ebuild b/net-mail/stalwart-bin/stalwart-bin-1.1.0.ebuild new file mode 100644 index 0000000..fc1edc7 --- /dev/null +++ b/net-mail/stalwart-bin/stalwart-bin-1.1.0.ebuild @@ -0,0 +1,107 @@ +# 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 +}