Subject: [PATCH] testing/dcc new aport

From: Duncan Bellamy <[email-masked]>
Date: Sun, 26 Jan 2020 12:39:56 +0000

Add aport for dcc-servers.net dcc software, split into sub packages.
The default config has been changed to common settings and to listen
for requests from 127.0.0.1
---
 testing/dcc/10-dcc-alpine.patch | 36 +++++++++++++
 testing/dcc/20-dcc-config.patch | 22 ++++++++
 testing/dcc/APKBUILD            | 93 +++++++++++++++++++++++++++++++++
 testing/dcc/dcc.confd           |  6 +++
 testing/dcc/dcc.initd           | 20 +++++++
 testing/dcc/dcc.post-install    |  5 ++
 testing/dcc/dcc.pre-install     |  6 +++
 7 files changed, 188 insertions(+)
 create mode 100644 testing/dcc/10-dcc-alpine.patch
 create mode 100644 testing/dcc/20-dcc-config.patch
 create mode 100644 testing/dcc/APKBUILD
 create mode 100644 testing/dcc/dcc.confd
 create mode 100644 testing/dcc/dcc.initd
 create mode 100644 testing/dcc/dcc.post-install
 create mode 100644 testing/dcc/dcc.pre-install

diff --git a/testing/dcc/10-dcc-alpine.patch b/testing/dcc/10-dcc-alpine.patch
new file mode 100644
index 0000000000..a277084333
--- /dev/null
+++ b/testing/dcc/10-dcc-alpine.patch
@@ -0,0 +1,36 @@
+--- a/configure
++++ b/configure
+@@ -465,6 +465,11 @@
+ #define DCC_UNIX 1
+ EOF
+ 
++if test -f /etc/alpine-release; then
++cat >> confdefs.h <<\EOF
++#define DCC_ALPINE 1
++EOF
++fi
+ 
+ # How were we started?
+ #   Mangle $@ to prevent duplicates from updatedcc -cwhatever
+--- a/include/dcc_config.h.in
++++ b/include/dcc_config.h.in
+@@ -33,6 +33,7 @@
+ 
+ 
+ #undef DCC_UNIX
++#undef DCC_ALPINE
+ #undef DCC_WIN32			/* define DCC_WIN32 in the makefiles */
+ #if !defined(DCC_UNIX) && !defined(DCC_WIN32)
+ #error "you must run ./configure"
+--- a/include/dcc_types.h
++++ b/include/dcc_types.h
+@@ -29,6 +29,9 @@
+ 
+ /* work on WIN32 and any reasonable UNIX platform */
+ #ifdef DCC_UNIX
++# ifdef DCC_ALPINE
++#  include <sys/types.h>
++# endif
+ #include <stdarg.h>
+ #include <stdio.h>			/* for FreeBSD */
+ #include <stdlib.h>
diff --git a/testing/dcc/20-dcc-config.patch b/testing/dcc/20-dcc-config.patch
new file mode 100644
index 0000000000..ea4163fdea
--- /dev/null
+++ b/testing/dcc/20-dcc-config.patch
@@ -0,0 +1,22 @@
+--- a/homedir/dcc_conf.in
++++ b/homedir/dcc_conf.in
+@@ -88,8 +88,8 @@
+ #   does not affect the blacklisting of the DCCM_WHITECLNT whitelist file.
+ # Add '-aIGNORE' to DCCM_ARGS to ignore the bulkiness of mail except to
+ #   add X-DCC headers.
+-DCCM_LOG_AT=5
+-DCCM_REJECT_AT=
++DCCM_LOG_AT=NEVER
++DCCM_REJECT_AT=MANY
+ # override basic list of DCC server checksums controlling rejections or logging
+ DCCM_CKSUMS=
+ # additional DCC server checksums worthy of rejections or logging
+@@ -101,7 +101,7 @@
+ # used to start dccifd
+ #   a common value is
+ #   DCCIFD_ARGS="-SHELO -Smail_host -SSender -SList-ID"
+-DCCIFD_ARGS="-SHELO -Smail_host -SSender -SList-ID"
++DCCIFD_ARGS="-SHELO -Smail_host -SSender -SList-ID -p *,10045,127.0.0.1/32"
+ DCCIFD_LOGDIR="$DCCM_LOGDIR"
+ DCCIFD_WHITECLNT="$DCCM_WHITECLNT"
+ #   When both dccm and dccifd are used it may be necessary to set
diff --git a/testing/dcc/APKBUILD b/testing/dcc/APKBUILD
new file mode 100644
index 0000000000..d8e30dd90c
--- /dev/null
+++ b/testing/dcc/APKBUILD
@@ -0,0 +1,93 @@
+# Contributor: Duncan Bellamy <[email-masked]>
+# Maintainer: Duncan Bellamy <[email-masked]>
+pkgname="dcc"
+pkgver="2.3.167"
+pkgrel=1
+pkgdesc="Distributed Checksum Clearinghouses or DCC spam filter"
+url="https://www.dcc-servers.net/dcc/"
+arch="all"
+license="custom"
+pkgusers="dcc"
+pkggroups="dcc"
+depends="dcc-openrc"
+makedepends="libmilter-dev"
+subpackages="$pkgname-dccd $pkgname-dccifd $pkgname-dccm
+	$pkgname-openrc $pkgname-doc"
+source="$pkgname-$pkgver.tar.gz::https://www.dcc-servers.net/src/dcc/old/dcc-$pkgver.tar.Z
+	10-"$pkgname"-alpine.patch
+	20-"$pkgname"-config.patch	
+	$pkgname.confd
+	$pkgname.initd
+"
+install="$pkgname.pre-install $pkgname.post-install"
+options="!check"
+
+prepare() {
+	chmod 755 configure
+	chmod 644 include/dcc_types.h include/dcc_config.h.in homedir/dcc_conf.in
+	default_prepare
+}
+
+build() {
+	./configure \
+		--with-installroot="$pkgdir" \
+		--bindir="/usr/bin" \
+		--mandir="/usr/man" \
+		--with-uid=dcc
+	make
+}
+
+package() {
+	make install
+	install -Dm644 "$builddir"/LICENSE \
+		usr/share/licenses/$pkgname/LICENSE
+
+	cd "$pkgdir"
+	install -Dm 755 "$srcdir"/$pkgname.initd etc/init.d/$pkgname
+	install -Dm 644 "$srcdir"/$pkgname.confd etc/conf.d/$pkgname
+
+	chmod 755 "$pkgdir"/var/dcc/libexec/dccsight
+	cd "$pkgdir"/usr/bin
+	chmod 755 cdcc dccproc
+}
+
+dccd() {
+	pkgdesc="$pkgdesc (dccd server with grey listing)"
+	depends="dcc"
+	_p=var/dcc/libexec
+	cd "$pkgdir"/$_p
+	amove "$_p"/dccd "$_p"/start-dccd "$_p"/stop-dccd "$_p"/start-grey
+}
+
+dccifd() {
+	pkgdesc="$pkgdesc (dccifd server)"
+	depends="dcc"
+	cd "$pkgdir"
+	amove var/dcc/libexec/dccifd var/dcc/libexec/start-dccifd
+}
+
+dccm() {
+	pkgdesc="$pkgdesc (dccm server)"
+	depends="dcc"
+	cd "$pkgdir"
+	amove var/dcc/libexec/dccm var/dcc/libexec/start-dccm
+}
+
+extras() {
+	pkgdesc="$pkgdesc (dcc update and uninstall)"
+	depends="dcc"
+	cd "$pkgdir"
+	amove var/dcc/libexec/updatedcc var/dcc/libexec/uninstalldcc
+}
+
+doc() {
+	pkgdesc="$pkgdesc (man files)"
+	cd "$pkgdir"
+	amove usr/man
+}
+
+sha512sums="384a572e5b18bed6aed08dce6ebc468d5737b0cb4774fe502f527b101a38b4bec1fdd73384c6fb437c21ae46aa56ae04c5c459737cdda6ab3ce186ff4f77cf98  dcc-2.3.167.tar.gz
+8efe22be50da74abdf8fe26de028f13d7ee572c0f1fcfb174bcd8083523c0c5d2b0a5c2580d77d031c23f5ce728e045a6ba8ef9069a19cc6bcfe865142849d41  10-dcc-alpine.patch
+8f7455cb8d49f26688fb8110c1a75311d9a8365e384dedbad7ab48bccdce6c0114f0c22d2024d05ab31d7ae5cdacf96972d8a7c0c361b767bde6532e1d9a94c7  20-dcc-config.patch
+14a5d890ecff4081b369b26308d6225ab06d535f159ac59f6554335788bab4684717118f69cbe256075f57af2fc27639a5bcc6ab1bded3590e19cb3b5094ccb8  dcc.confd
+a685383af856ea00be0333e4eccf1a8cd8869a286e28c706fb5f296b1e3b1612053f031963524207f614dae3847c165a067ec028dd5fce4f8c8c0f126388ff90  dcc.initd"
diff --git a/testing/dcc/dcc.confd b/testing/dcc/dcc.confd
new file mode 100644
index 0000000000..c5ecb59234
--- /dev/null
+++ b/testing/dcc/dcc.confd
@@ -0,0 +1,6 @@
+# dcc conf.d file for alpine linux
+
+#
+# Specify daemon options in /var/dcc/dcc_conf
+#
+#dcc_opts=""
diff --git a/testing/dcc/dcc.initd b/testing/dcc/dcc.initd
new file mode 100644
index 0000000000..e51bae4bc6
--- /dev/null
+++ b/testing/dcc/dcc.initd
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+
+# dcc init.d file for alpine linux.
+# edit /var/dcc/dcc_conf instead of passing options
+name=dcc
+command="/var/dcc/libexec/rcDCC"
+command_args="start"
+command_background="no"
+
+start_stop_daemon_args="--user dcc:dcc"
+pidfile="/run/$name.pid"
+
+depend() {
+	need net
+	after firewall
+}
+
+start_pre() {
+
+}
diff --git a/testing/dcc/dcc.post-install b/testing/dcc/dcc.post-install
new file mode 100644
index 0000000000..7065813527
--- /dev/null
+++ b/testing/dcc/dcc.post-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+[ ! -f /etc/crontabs/dcc ] && \
+	echo '@daily /var/dcc/libexec/cron-dccd' | crontab -u dcc -
+
+exit 0
diff --git a/testing/dcc/dcc.pre-install b/testing/dcc/dcc.pre-install
new file mode 100644
index 0000000000..7c1e7311d0
--- /dev/null
+++ b/testing/dcc/dcc.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S dcc 2>/dev/null
+adduser -S -H -h /var/dcc --gecos "DCC antispam" --ingroup dcc dcc 2>/dev/null
+
+exit 0
-- 
2.24.1