This commit is contained in:
Micha Glave 2019-06-12 23:04:44 +02:00
commit 488b2bd14a
6 changed files with 200 additions and 0 deletions

View File

@ -0,0 +1,6 @@
AUX rspamd-r1.logrotate 305 BLAKE2B 58e816e54fd0a7e977dd2f6dcf97617c188888ffea66769ef60ce799f980e2814221734fee7b47c93790a5bbfecbb2f315f93c84bec9dd29b0f80c15e1b9e349 SHA512 0515d31a890058194106d9b8960d77909914986e73619dede751be2efb9592a41f90f15599310b5d6d027c3a203df412c8379ade7df09ecdfd4dcf43bfff4fa7
AUX rspamd-r6.init 1370 BLAKE2B 333683396f499c3d1cfc92d67434fc9d1fdab695b1ddf9798d0bed42b227111cb9c779fd33e04bb095affd09326edf6f80100d58248061795bf3540e2e9e0771 SHA512 40016348ed413414c9a06182f8da896bcb5b0f48bf7ec51db1cd7e4f9adea59e30c6c5ddc79135141b795e829af2660c047ed8f93fed1e181f9f2f01a419d690
AUX rspamd.conf 908 BLAKE2B 9d8c310c00990f47012e9d1710fbb7567ae5b0e92a411d3fb2696bfb32b70c31ceeaded873f06c759a471d534fb872656907e73ee095150fae384de4df6e9946 SHA512 753011de167af9261cc67676357aadf34d0b160d343a20d5efe8b3389e8a604775b7a6abbaad3174acae7df5579b52b4ba8a0a714419084befedfa96a3a8a9b1
AUX rspamd.tmpfile 33 BLAKE2B 3ce0f8ab29a2ca259023f90b12799d8c7f0f099a98ef1eb4abe3b3d3e6046d362dae9efc723dd675dff8f1c1df9d05c09e539fcd251382cd9fc5e92351ece8a9 SHA512 1c7e6b79a05cdf9a886c6e233417a0d7b398a1e27ddd3b19c3a595afd50e502a7fd7c09a3499cb9fe6e0291b8493d150550b094c8bf6e2221b71915239c72ef8
DIST rspamd-1.9.4.tar.gz 4476230 BLAKE2B e4866fb8fd97210e77b75d948ae97f038eccc33ec9f6214693579e5d84210c87ff9258204f466ffe6bea780159d24d819aaf393a06dbf2785659a784e4f4e8b6 SHA512 3acecec6adb91580ac2ad96419fdc9588b120ec5a3b4a44135fc5a3e7c15f2dbc99963a8337f9effb9423846489545a55d89d1849c5ba62d8cd91dc67c32d8dc
EBUILD rspamd-1.9.4.ebuild 2242 BLAKE2B f294fc165ccf83af918e37b5f4659bbca79e1fae2b378d4c7218074dcac318c3faea6ef10eb59bff59fc4ca3ea5115182d53948debdc6314ee457d70598a4df8 SHA512 c6f28512d0dee9213dcd48d7df0c3672c2f86d520090ed392efaa0c27ac0e27653ce487e5570953d34b50d6bfbc2c74d282f3ecd8d67acf1b5874f55c7f59797

View File

@ -0,0 +1,16 @@
/var/log/rspamd/rspamd.log {
daily
rotate 4
delaycompress
compress
notifempty
missingok
postrotate
if test -d /run/systemd/system ; then
systemctl kill -s USR1 --kill-who=main rspamd.service
else
test -r /run/rspamd.pid && kill -USR1 $(cat /run/rspamd.pid) &>/dev/null
fi
endscript
}

View File

@ -0,0 +1,55 @@
#!/sbin/openrc-run
# Copyright 2015-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
RSPAMD_CONFIGFILE=${RSPAMD_CONFIGFILE:-"/etc/rspamd/rspamd.conf"}
RSPAMD_GROUP=${RSPAMD_GROUP:-rspamd}
RSPAMD_OPTS=${RSPAMD_OPTS:-""}
RSPAMD_PIDFILE=${RSPAMD_PIDFILE:-"/run/rspamd.pid"}
RSPAMD_USER=${RSPAMD_USER:-rspamd}
command="/usr/bin/rspamd"
command_args="${RSPAMD_OPTS} -c \"${RSPAMD_CONFIGFILE}\" -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} --pid \"${RSPAMD_PIDFILE}\""
start_stop_daemon_args=${RSPAMD_SSDARGS:-"--wait 1000"}
pidfile="${RSPAMD_PIDFILE}"
retry=${RSPAMD_TERMTIMEOUT:-"TERM/60/KILL/5"}
required_files="${RSPAMD_CONFIGFILE}"
description="Rapid spam filtering system"
extra_commands="checkconfig"
extra_started_commands="reload"
description_checkconfig="Validate rspamd's configuration"
description_reload="Sends rspamd a signal to reload its configuration"
depend() {
before mta
use dns redis
}
checkconfig() {
${command} -c "${RSPAMD_CONFIGFILE}" -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} -t 1>/dev/null \
|| return 1
}
reload() {
checkconfig || return 1
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}
start_pre() {
if [ "${RC_CMD}" != "restart" ]; then
checkconfig || return 1
fi
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ]; then
checkconfig || return 1
fi
}

View File

@ -0,0 +1,26 @@
# /etc/conf.d/rspamd
# Configuration file
#RSPAMD_CONFIGFILE="/etc/rspamd/rspamd.conf"
# PID file
# If you should ever change this, remember to update
# "/etc/logrotate.d/rspamd", too.
#RSPAMD_PIDFILE="/run/rspamd.pid"
# You can use this configuration option to pass additional options to the
# start-stop-daemon, see start-stop-daemon(8) for more details.
# Per default we wait 1000ms after we have started the service to ensure
# that the daemon is really up and running.
#RSPAMD_SSDARGS="--wait 1000"
# The termination timeout (start-stop-daemon parameter "retry") ensures
# that the service will be terminated within a given time (60 + 5 seconds
# per default) when you are stopping the service.
#RSPAMD_TERMTIMEOUT="TERM/60/KILL/5"
# Options to rspamd
# See rspamd(8) for more details
# Notes:
# * Do not specify another CONFIGFILE but use the variable above to change the location
#RSPAMD_OPTS=""

View File

@ -0,0 +1 @@
d /run/rspamd 0755 rspamd rspamd

View File

@ -0,0 +1,96 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-utils pax-utils systemd tmpfiles user
if [[ ${PV} == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/vstakhov/rspamd.git"
inherit git-r3
else
SRC_URI="https://github.com/vstakhov/rspamd/archive/${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~x86"
fi
DESCRIPTION="Rapid spam filtering system"
HOMEPAGE="https://github.com/vstakhov/rspamd"
LICENSE="Apache-2.0"
SLOT="0"
IUSE="cpu_flags_x86_ssse3 gd jemalloc +jit libressl pcre2 +torch"
REQUIRED_USE="torch? ( jit )"
RDEPEND="dev-db/sqlite:3
dev-libs/glib:2
dev-libs/icu:=
dev-libs/libevent:=
net-libs/libnsl
sys-apps/file
dev-util/ragel
cpu_flags_x86_ssse3? ( dev-libs/hyperscan )
gd? ( media-libs/gd[jpeg] )
jemalloc? ( dev-libs/jemalloc )
jit? ( dev-lang/luajit:2 )
!libressl? ( dev-libs/openssl:0=[-bindist] )
libressl? ( dev-libs/libressl:0= )
pcre2? ( dev-libs/libpcre2[jit=] )
!pcre2? ( dev-libs/libpcre[jit=] )"
DEPEND="${RDEPEND}"
pkg_setup() {
enewgroup rspamd
enewuser rspamd -1 -1 /var/lib/rspamd rspamd
}
src_prepare() {
cmake-utils_src_prepare
sed -i -e 's/User=_rspamd/User=rspamd/g' \
rspamd.service \
|| die
}
src_configure() {
local mycmakeargs=(
-DCONFDIR=/etc/rspamd
-DRUNDIR=/var/run/rspamd
-DDBDIR=/var/lib/rspamd
-DLOGDIR=/var/log/rspamd
-DENABLE_LUAJIT=$(usex jit ON OFF)
-DENABLE_GD=$(usex gd ON OFF)
-DENABLE_PCRE2=$(usex pcre2 ON OFF)
-DENABLE_JEMALLOC=$(usex jemalloc ON OFF)
-DENABLE_HYPERSCAN=$(usex cpu_flags_x86_ssse3 ON OFF)
-DENABLE_TORCH=$(usex torch ON OFF)
)
cmake-utils_src_configure
}
src_test() {
cmake-utils_src_test
}
src_install() {
cmake-utils_src_install
newconfd "${FILESDIR}"/rspamd.conf rspamd
newinitd "${FILESDIR}/rspamd-r6.init" rspamd
systemd_newunit rspamd.service rspamd.service
newtmpfiles "${FILESDIR}"/${PN}.tmpfile ${PN}.conf
# Remove mprotect for JIT support
if use jit; then
pax-mark m "${ED%/}"/usr/bin/rspamd-* "${ED%/}"/usr/bin/rspamadm-*
fi
insinto /etc/logrotate.d
newins "${FILESDIR}"/rspamd-r1.logrotate rspamd
diropts -o rspamd -g rspamd
keepdir /var/{lib,log}/rspamd
}
pkg_postinst() {
tmpfiles_process "${PN}.conf"
}