Subject: [alpine-aports] [PATCH] testing/spampd: new aport

From: Chloe Kudryavtsev <[email-masked]>
Date: Sat, 3 Nov 2018 21:22:59 -0400

https://www.worlddesign.com/index.cfm/page/software/open-source/spampd.htm
An SMTP / LMTP proxy that uses spamassassin to mark spam.
Similar to amavisd-new, but lets spamassassin modify headers directly,
and significantly simpler to use/configure.
---
 testing/spampd/APKBUILD           | 41 +++++++++++++++++++++++++++++++
 testing/spampd/spampd.confd       | 13 ++++++++++
 testing/spampd/spampd.initd       | 16 ++++++++++++
 testing/spampd/spampd.pre-install |  6 +++++
 4 files changed, 76 insertions(+)
 create mode 100644 testing/spampd/APKBUILD
 create mode 100644 testing/spampd/spampd.confd
 create mode 100644 testing/spampd/spampd.initd
 create mode 100644 testing/spampd/spampd.pre-install

diff --git a/testing/spampd/APKBUILD b/testing/spampd/APKBUILD
new file mode 100644
index 0000000000..026dc772bf
--- /dev/null
+++ b/testing/spampd/APKBUILD
@@ -0,0 +1,41 @@
+# Maintainer: Chloe Kudryavtsev <[email-masked]>
+pkgname=spampd
+pkgver=2.51
+pkgrel=0
+pkgdesc="An L/SMTP proxy that marks spam using spamassassin."
+url="http://www.worlddesign.com/index.cfm/page/software/open-source/spampd.htm"
+arch="noarch"
+license="GPL-2.0-or-later"
+depends="perl-net-server perl-mail-spamassassin"
+makedepends=""
+install="spampd.pre-install"
+subpackages="$pkgname-openrc" # spampd.8 seems to have been removed at some point
+source="
+	spampd.confd
+	spampd.initd
+	$pkgname-$pkgver.tar.gz::https://github.com/mpaperno/$pkgname/archive/$pkgver.tar.gz
+	"
+builddir="$srcdir/$pkgname-$pkgver"
+pkgusers="spampd"
+pkggroups="spampd"
+
+build() {
+	return 0
+}
+
+check() {
+	cd "$builddir"
+	./spampd.pl -? # even --version is missing, but if there's a missing module, this fails
+}
+
+package() {
+	install -m755 -D "$builddir/$pkgname.pl" "$pkgdir/usr/bin/$pkgname"
+}
+
+openrc() {
+	install -m755 -D "$srcdir/$pkgname.initd" "$subpkgdir/etc/init.d/$pkgname"
+	install -m644 -D "$srcdir/$pkgname.confd" "$subpkgdir/etc/conf.d/$pkgname"
+}
+sha512sums="216ab774ac2cc8b54fb8f2155738fd41264b261efd5a7ab95d9910aad5b9699065f42211dbe8021383f0172bfb50cfc9087ea8dc1e53a2223dabd7faf490769c  spampd.confd
+4adad6b44509abedcfb5726d09a63b66048468e5ee7942d0e586630a84fb93931f315ed9410894af2cc4e5bff04cd38600ea91cc0b18c3cedd67efe2af6e0e14  spampd.initd
+a766815e2c563f4ba520a423adee34791cb901d301872cfcdc4047ff4668f74e0ecf488e6ad964dd45bd530686440f249b7656ce0ae95cca7fdae42b02badd32  spampd-2.51.tar.gz"
diff --git a/testing/spampd/spampd.confd b/testing/spampd/spampd.confd
new file mode 100644
index 0000000000..3a9f88d8f6
--- /dev/null
+++ b/testing/spampd/spampd.confd
@@ -0,0 +1,13 @@
+user=spampd
+group=spampd
+
+#host=127.0.0.1
+#port=10025
+#sock=/run/spampd.sock # overrides host and port
+#smod=660
+
+#rhost=127.0.0.1
+rport=10026
+#rsock=/run/dovecot/lmtp # user:group must have r/w permissions
+
+args="--dose" # add -d here if desired
diff --git a/testing/spampd/spampd.initd b/testing/spampd/spampd.initd
new file mode 100644
index 0000000000..139830f158
--- /dev/null
+++ b/testing/spampd/spampd.initd
@@ -0,0 +1,16 @@
+#!/sbin/openrc-run
+command="/usr/bin/spampd"
+pidfile="/run/${RC_SVCNAME}.pid"
+command_args="-p=$pidfile
+    ${user:+-u=$user} ${group:+-g=$group}
+    ${host:+--host=$host} ${port:+--port=$port}
+    ${sock:+--socket=$sock} ${smod:+--socket-perms=$smod}
+    ${rhost:+--relayhost=$rhost} ${rport:+--relayport=$rport}
+    ${rsock:+--relaysocket=$rsock}
+    $args"
+
+# no reload because HUP does not reload spamassassin configuration
+
+depend() {
+    before mta
+}
diff --git a/testing/spampd/spampd.pre-install b/testing/spampd/spampd.pre-install
new file mode 100644
index 0000000000..40d8a8c82c
--- /dev/null
+++ b/testing/spampd/spampd.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S spampd 2>/dev/null
+adduser -S -D -H -s /sbin/nologin -G spampd -g spampd spampd 2>/dev/null
+
+exit 0
-- 
2.19.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Chloe Kudryavtsev <[email-masked]>
Date: Tue, 6 Nov 2018 21:48:21 -0500

Changes v1 -> v2:
 - split functions split rather than package
 - include documentation
 - add contributor line

 testing/spampd/APKBUILD           | 46 +++++++++++++++++++++++++++++++
 testing/spampd/spampd.confd       | 13 +++++++++
 testing/spampd/spampd.initd       | 16 +++++++++++
 testing/spampd/spampd.pre-install |  6 ++++
 4 files changed, 81 insertions(+)
 create mode 100644 testing/spampd/APKBUILD
 create mode 100644 testing/spampd/spampd.confd
 create mode 100644 testing/spampd/spampd.initd
 create mode 100644 testing/spampd/spampd.pre-install

diff --git a/testing/spampd/APKBUILD b/testing/spampd/APKBUILD
new file mode 100644
index 0000000000..1212806b98
--- /dev/null
+++ b/testing/spampd/APKBUILD
@@ -0,0 +1,46 @@
+# Contributor: Chloe Kudryavtsev <[email-masked]>
+# Maintainer: Chloe Kudryavtsev <[email-masked]>
+pkgname=spampd
+pkgver=2.51
+pkgrel=1
+pkgdesc="An L/SMTP proxy that marks spam using spamassassin"
+url="http://www.worlddesign.com/index.cfm/page/software/open-source/spampd.htm"
+arch="noarch"
+license="GPL-2.0-or-later"
+depends="perl-net-server perl-mail-spamassassin"
+makedepends=""
+install="spampd.pre-install"
+subpackages="$pkgname-doc $pkgname-openrc"
+source="
+	spampd.confd
+	spampd.initd
+	$pkgname-$pkgver.tar.gz::https://github.com/mpaperno/$pkgname/archive/$pkgver.tar.gz
+	"
+builddir="$srcdir/$pkgname-$pkgver"
+pkgusers="spampd"
+pkggroups="spampd"
+
+build() {
+	return 0
+}
+
+check() {
+	cd "$builddir"
+	# even --version is missing. -? fails if a module is missing
+	./spampd.pl -?
+}
+
+package() {
+	install -m755 -D "$builddir/$pkgname.pl" "$pkgdir/usr/bin/$pkgname"
+	install -m755 -D "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
+	install -m644 -D "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname"
+	install -m644 -D "$builddir/$pkgname.html" \
+		"$pkgdir/usr/share/html/$pkgname.html"
+}
+
+openrc() {
+	mv "$pkgdir/etc" "$subpkgdir/"
+}
+sha512sums="216ab774ac2cc8b54fb8f2155738fd41264b261efd5a7ab95d9910aad5b9699065f42211dbe8021383f0172bfb50cfc9087ea8dc1e53a2223dabd7faf490769c  spampd.confd
+4adad6b44509abedcfb5726d09a63b66048468e5ee7942d0e586630a84fb93931f315ed9410894af2cc4e5bff04cd38600ea91cc0b18c3cedd67efe2af6e0e14  spampd.initd
+a766815e2c563f4ba520a423adee34791cb901d301872cfcdc4047ff4668f74e0ecf488e6ad964dd45bd530686440f249b7656ce0ae95cca7fdae42b02badd32  spampd-2.51.tar.gz"
diff --git a/testing/spampd/spampd.confd b/testing/spampd/spampd.confd
new file mode 100644
index 0000000000..3a9f88d8f6
--- /dev/null
+++ b/testing/spampd/spampd.confd
@@ -0,0 +1,13 @@
+user=spampd
+group=spampd
+
+#host=127.0.0.1
+#port=10025
+#sock=/run/spampd.sock # overrides host and port
+#smod=660
+
+#rhost=127.0.0.1
+rport=10026
+#rsock=/run/dovecot/lmtp # user:group must have r/w permissions
+
+args="--dose" # add -d here if desired
diff --git a/testing/spampd/spampd.initd b/testing/spampd/spampd.initd
new file mode 100644
index 0000000000..139830f158
--- /dev/null
+++ b/testing/spampd/spampd.initd
@@ -0,0 +1,16 @@
+#!/sbin/openrc-run
+command="/usr/bin/spampd"
+pidfile="/run/${RC_SVCNAME}.pid"
+command_args="-p=$pidfile
+    ${user:+-u=$user} ${group:+-g=$group}
+    ${host:+--host=$host} ${port:+--port=$port}
+    ${sock:+--socket=$sock} ${smod:+--socket-perms=$smod}
+    ${rhost:+--relayhost=$rhost} ${rport:+--relayport=$rport}
+    ${rsock:+--relaysocket=$rsock}
+    $args"
+
+# no reload because HUP does not reload spamassassin configuration
+
+depend() {
+    before mta
+}
diff --git a/testing/spampd/spampd.pre-install b/testing/spampd/spampd.pre-install
new file mode 100644
index 0000000000..40d8a8c82c
--- /dev/null
+++ b/testing/spampd/spampd.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S spampd 2>/dev/null
+adduser -S -D -H -s /sbin/nologin -G spampd -g spampd spampd 2>/dev/null
+
+exit 0
-- 
2.19.1

---

---

From: Chloe Kudryavtsev <[email-masked]>
Date: Tue, 6 Nov 2018 22:26:52 -0500

https://www.worlddesign.com/index.cfm/page/software/open-source/spampd.htm
An SMTP / LMTP proxy that uses spamassassin to mark spam.
Similar to amavisd-new, but lets spamassassin modify headers directly,
and significantly simpler to use/configure.
---
Changes v1 -> v2:
 - split functions split rather than package
 - include documentation
 - add contributor line
Changes v2 -> v3:
 $subpkgdir is not auto-created, which caused /conf.d (etc) to be
 installed rather than /etc/conf.d.

 testing/spampd/APKBUILD           | 47 +++++++++++++++++++++++++++++++
 testing/spampd/spampd.confd       | 13 +++++++++
 testing/spampd/spampd.initd       | 16 +++++++++++
 testing/spampd/spampd.pre-install |  6 ++++
 4 files changed, 82 insertions(+)
 create mode 100644 testing/spampd/APKBUILD
 create mode 100644 testing/spampd/spampd.confd
 create mode 100644 testing/spampd/spampd.initd
 create mode 100644 testing/spampd/spampd.pre-install

index 0000000000..23e5a9ef34
@@ -0,0 +1,47 @@
+pkgrel=2
+	mkdir -p "$subpkgdir"

---