mail-filter/hashcash-milter: new ebuild (luke-jr overlay has an older version that doesn't build anymore)

This commit is contained in:
2019-12-15 22:52:45 -08:00
parent 39450707eb
commit 569e6df01a
4 changed files with 143 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
AUX hashcash-milter.confd 117 SHA256 a01b4973cebe85b309121c22b44da2eabe76c49fbb408a923e13d2904b6f9182 SHA512 1c780eb1fb06e37dc1289db9d539f8afccde284526f60df9b8083d04b9f8289ff2310d5f3d2eb1a5cc645683309c271ebdad4697bdc9836507d8fb1dbf229c61 WHIRLPOOL 2266ba0b58accac0f1a19715869e7b3b6723f9f6f63a21290ae60de3f603960fe04782a87e2410772839c20cff7537a38c34be0f19162cb41436641309052c56
AUX hashcash-milter.initd 2269 SHA256 fe6ac09f3b59357af49155dee2f756d86369386dab910ea1bc1944f59553eddc SHA512 20b851244e1d37a09295f3ed3c514335d28e60026f2fc655fe3078916f7dc3e4a6c455f8e7915bf1666eec5d885cc57bbd4b4dbf3cac370dbd701060cef4cf87 WHIRLPOOL 4ca6af727910dc3e0d0c121a1909c2d16c5d90d73a43c7b635727fafd5a7a6f5a3a0ad78d2cbd1db62179177f0f1943db56cf1514b27ae3c80dd83d1c66b4b45
DIST hashcash-milter-0.1.3.tar.gz 30566 SHA256 564f79764d8182a689e85cdd589e3c2661c43aeffb1340347e1ecbdb888da5c0 SHA512 d2fd6a83de06dadc3f2ab927656ec0f29d5999940ed3fb6c0cdcdb5e641e09aa86a1ac8e9f8df35a4590456102e4102c71bd1a5e0385a91e96c7fa2759ebc0d2 WHIRLPOOL a5848c468d195bde0fd04b42ab7506f471c40c0731b33b56e7887d49fbd1d222969a26e5cd83fc8bcbc03f7f793591cb42acff3848cdaf449f12b30bae5b31e8
EBUILD hashcash-milter-0.1.3.ebuild 1242 SHA256 664727351d6fb1fb307c64bb6f3482ba69b6e727d994db9e6dcc1bcd0051d2f4 SHA512 ade2d00b9e4ef1ce18c59ce567f771fbc671845a36b1112e81b1c7478859fb3c87e16b6d2faa85ff7f5feac16120aa49bec9d0690d56342e0fcfd35e6de76f26 WHIRLPOOL c6a1622ae28b965bb872572c05c04f4aae9bf57adc185c6d5b279b94f0214d0eed6994250395b7cfd253ff321205b313856e7c62681939087ef3ffcd9b7b05a5

View File

@@ -0,0 +1,2 @@
SOCKETSPEC="inet:8029@localhost"
HASHCASH_MILTER_OPTS="-p $SOCKETSPEC -u milter -P /var/run/sid-filter.pid -a -m 20"

View File

@@ -0,0 +1,89 @@
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
depend() {
use logger net
}
parse_opts() {
local milter_opt milter_flag=
for milter_opt in ${HASHCASH_MILTER_OPTS}; do
case "${milter_flag}" in
-u) milter_user=${milter_opt}
;;
-P) milter_pid=${milter_opt}
;;
esac
[ -n "${milter_user}" -a -n "${milter_pid}" ] && break
milter_flag=${milter_opt}
done
if [ -z "${milter_user}" ]; then
milter_user=milter
HASHCASH_MILTER_OPTS="${HASHCASH_MILTER_OPTS} -u ${milter_user}"
fi
if [ -z "${milter_pid}" ]; then
milter_pid="/var/run/hashcash-milter.pid"
HASHCASH_MILTER_OPTS="${HASHCASH_MILTER_OPTS} -P ${milter_pid}"
fi
}
clean_socket() {
local socket_file= svc_pid=
socket_file="$(echo ${HASHCASH_MILTER_OPTS} | sed -e 's/.*local:\(.*\) .*/\1/' | awk '{print $1}')"
svc_pid="$(ps -C hashcash-milter -o pid=)"
if [ -z "${svc_pid}" ] && [ ! -z "${socket_file}" ] && [ -S "${socket_file}" ]; then
ewarn "Strange, the socket file already exist in \"${socket_file}\""
ewarn "it will be removed now and re-created by the hashcash-milter server"
ewarn "BUT please make your checks."
rm -f "${socket_file}"
fi
}
check_socketdir() {
local socket_dir
case "${SOCKETSPEC}" in
local:*) socket_dir="$(echo ${SOCKETSPEC} | sed -e 's~^local:\(.*\)/.*$~\1~')"
if [ ! -d ${socket_dir} ]; then
checkpath -q -d -o ${milter_user}:${milter_user} -m 0755 ${socket_dir} || return 1
fi ;;
inet:*) ;;
inet6:*) ;;
*) eerror "Unknown socket spec. Please check your /etc/conf.d/hashcash-milter file."
return 1 ;;
esac
}
start() {
local milter_user= milter_pid=
clean_socket
parse_opts
check_socketdir || return 1
if ! (touch ${milter_pid} && chown ${milter_user} ${milter_pid}) ; then
eerror "Failed to create pidfile"
return 1
fi
ebegin "Starting Hashcash Milter"
start-stop-daemon --start --exec /usr/bin/hashcash-milter -- ${HASHCASH_MILTER_OPTS}
eend $?
}
stop() {
local milter_user= milter_pid=
parse_opts
ebegin "Stopping Hashcash Milter"
start-stop-daemon --stop --quiet --name hashcash-milter --pidfile ${milter_pid}
eend $?
if [ $? = 0 -a -f "${milter_pid}" ]; then
rm ${milter_pid}
fi
}

View File

@@ -0,0 +1,48 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
inherit eutils flag-o-matic toolchain-funcs user
DESCRIPTION="A milter-based application to mint and check HashCash stamps"
HOMEPAGE="http://althenia.net/hashcash"
SRC_URI="http://althenia.net/files/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="sys-libs/db
|| ( mail-filter/libmilter mail-mta/sendmail )"
RDEPEND="${DEPEND}"
pkg_setup() {
enewgroup milter
# mail-milter/spamass-milter creates milter user with this home directory
# For consistency reasons, milter user must be created here with this home directory
# even though this package doesn't need a home directory for this user (#280571)
enewuser milter -1 -1 /var/lib/milter milter
}
src_configure() {
local CC="$(tc-getCC)"
append-ldflags $(no-as-needed)
einfo ./configure CC="$(tc-getCC)" CFLAGS="-D_GNU_SOURCE ${CFLAGS}" LDFLAGS="${LDFLAGS}"
./configure CC="$(tc-getCC)" CFLAGS="-D_GNU_SOURCE ${CFLAGS}" LDFLAGS="${LDFLAGS}"
}
src_compile() {
emake
}
src_install() {
dobin hashcash-milter
newinitd "${FILESDIR}/${PN}.initd" "${PN}"
newconfd "${FILESDIR}/${PN}.confd" "${PN}"
dodoc CHANGES README
}