aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorPrzemyslaw Pawelczyk <przemoc@zoho.com>2016-06-17 03:47:30 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2016-06-20 13:35:25 +0000
commit071c1400c272c0f381651a0dc9b181ab0abfc1fc (patch)
tree0a4bfda4a910a0cce3d59bbff34bce1880c0eeea /testing
parent94e0b0631f3760e6ba47edf9dbb2637a575a8019 (diff)
downloadaports-071c1400c272c0f381651a0dc9b181ab0abfc1fc.tar.bz2
aports-071c1400c272c0f381651a0dc9b181ab0abfc1fc.tar.xz
testing/clapf: Fix a lot of problems.
* APKBUILD: Leverage default_prepare and use builddir (no _). * APKBUILD: Update url and source url. Original tar seems not available anymore and there are no tags in clapf's bitbucket repository, so use commit marked as release of version that was shipped before. * APKBUILD: Introduce some constants for better DRY-ness, reformat package() function, create there a workdir (otherwise clapf won't start) and fix permissions. * APKBUILD: make -j1 is deliberate, as it fails with more jobs, but I am not willing to spend any more time on this package. * ldflags.patch: Set soname (otherwise -dev subpkg will haunt you). * clapf.confd: Make it somewhat usable. TMPDIR seemed useless. * clapf.initd: Rewrite using openrc-run default ssd functions. * clapf.pre-install: Change user and group to clapf. It has not been tested with mta, but at least it starts now if you have virus databases present. Run freshclam if you don't have them yet.
Diffstat (limited to 'testing')
-rw-r--r--testing/clapf/APKBUILD82
-rw-r--r--testing/clapf/clapf.confd10
-rw-r--r--testing/clapf/clapf.initd34
-rw-r--r--testing/clapf/clapf.pre-install4
-rw-r--r--testing/clapf/ldflags.patch2
5 files changed, 75 insertions, 57 deletions
diff --git a/testing/clapf/APKBUILD b/testing/clapf/APKBUILD
index a4cd101b1f..efc2438be2 100644
--- a/testing/clapf/APKBUILD
+++ b/testing/clapf/APKBUILD
@@ -4,7 +4,7 @@ pkgname=clapf
pkgver=0.4.7.4
pkgrel=1
pkgdesc="clapf is an open source email content filter application"
-url="http://clapf.acts.hu"
+url="http://clapf.org"
arch="all"
license="as-is"
depends="clamav-db"
@@ -12,31 +12,29 @@ depends_dev="gsl-dev mysql-dev clamav-dev zlib-dev bzip2-dev"
makedepends="$depends_dev autoconf automake"
install="$pkgname.pre-install"
options="suid"
-pkgusers="clapf"
+CLAPF_USER="clapf"
+CLAPF_GROUP="clapf"
+pkgusers="$CLAPF_USER"
+pkggroups="$CLAPF_GROUP"
subpackages="$pkgname-dev"
-source="http://clapf.acts.hu/clapf-$pkgver.tar.gz
+# * 31d2ce87967e released 0.4.7.4
+COMMIT=31d2ce87967e
+source="$pkgname-$pkgver-g$COMMIT.tar.gz::https://bitbucket.org/jsuto/$pkgname/get/$COMMIT.tar.gz
gsl-libs.patch
def__user.patch
ldflags.patch
+ clapf.confd
+ clapf.initd"
- $pkgname.confd
- $pkgname.initd"
-
-_builddir="$srcdir/$pkgname-$pkgver"
+builddir="$srcdir/jsuto-$pkgname-$COMMIT"
prepare() {
- local i
- cd "$_builddir"
- for i in $source; do
- case $i in
- *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
- esac
- done
+ default_prepare || return 1
aclocal && autoconf
}
build() {
- cd "$_builddir"
+ cd "$builddir"
./configure --prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
@@ -51,7 +49,7 @@ build() {
--enable-policy \
--enable-whitelist \
--enable-blackhole \
- --with-clapf-user=clapf \
+ --with-clapf-user=$CLAPF_USER \
--enable-language-detection \
--enable-memcached \
--enable-spamsum
@@ -60,30 +58,44 @@ build() {
}
package() {
- cd "$_builddir"
- make -j1 DESTDIR="$pkgdir" install || return 1
- install -Dm755 "$srcdir/$pkgname".initd \
- "$pkgdir/etc/init.d/$pkgname" || return 1
- install -Dm644 "$srcdir/$pkgname".confd \
- "$pkgdir/etc/cond.d/$pkgname" || return 1
- install -do $pkgname "$pkgdir"/var/run/clapf || return 1
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install \
+ || return 1
+ install -D -m 755 \
+ "$srcdir"/clapf.initd \
+ "$pkgdir"/etc/init.d/clapf \
+ || return 1
+ install -D -m 644 \
+ "$srcdir"/clapf.confd \
+ "$pkgdir"/etc/conf.d/clapf \
+ || return 1
+ install -d -o $CLAPF_USER -g $CLAPF_GROUP \
+ "$pkgdir"/var/run/$pkgname \
+ || return 1
+ mkdir -p \
+ "$pkgdir"/var/spool/clapf/tmp \
+ || return 1
+ chown -R $CLAPF_USER:$CLAPF_GROUP \
+ "$pkgdir"/var/lib/clapf \
+ "$pkgdir"/var/spool/clapf \
+ || return 1
}
-md5sums="e6be84e17886401b4818c6285a7b2888 clapf-0.4.7.4.tar.gz
+md5sums="0a38f56f717b170d8b6e5f780cd2281d clapf-0.4.7.4-g31d2ce87967e.tar.gz
7f480d5a8d0da4863b682deddfe47eff gsl-libs.patch
ba31f71c066f3f6159548808d2e26d8b def__user.patch
-c6bd9005236f6a40c32fe1f04fafc94b ldflags.patch
-385318b45b2bccdd76fd312576380735 clapf.confd
-263283c96608d696cd5e9eb9de921b16 clapf.initd"
-sha256sums="a38e5b28ff58119abf50054fac2c03b04f959251e844893f0c9f669ce76c99e3 clapf-0.4.7.4.tar.gz
+967743d70cdf21dd929117865c7053c0 ldflags.patch
+1e3786f78bbdfaba1f2d414f9fa19907 clapf.confd
+3ab39ee86b80ba8e19e8f41686d35bc6 clapf.initd"
+sha256sums="84b1e15462985531e865b5700200d1f0fc09289e5cce00f3d8ab0fdefe4b51cc clapf-0.4.7.4-g31d2ce87967e.tar.gz
4b4bb8530ac740a5279e0fdd959c6b706b3635792030f6b242e282f8d923202c gsl-libs.patch
0523e889808f6aa3ec71a34846cbdfc9d1b185463583dcd7239673d098402346 def__user.patch
-00035eb11386f40c68ebaea79c31659f19f4f5a29503d47e9e0d3a6efc32f9fe ldflags.patch
-1c5c87adfa2efdaa55d7c8e07ac7ca6b4a068313723dbf46dd1d1ccaf3e54e6a clapf.confd
-f5c849b01734115ff83e9a2bb0eb4a34bd25d20f646c7945a8887815a65f1ec3 clapf.initd"
-sha512sums="7eb95e25671d0ad4d37cd16f5c293bb7cc8466cbc3dd6b7ac250d75f277423f57012e57373bd8f69174bcb15e865caa33e97dd6adcb0a52553b6ce9069036b05 clapf-0.4.7.4.tar.gz
+d9b5fdbc6ca3118a3e382bcdca383ccca4cdac660303d39a7221bc6475f4eaac ldflags.patch
+429a4a6f832cb00f5fcfa0218656bcefa68d80f1f6d2f21ee4dfe1dceef15f69 clapf.confd
+bafcb80e5f142f9680a7b8a94c848d84a6940d6c807122d0ed10f004c035faf9 clapf.initd"
+sha512sums="f13428be93cd170e24c70e608d15ef7d6054fa1d57dc9dae4efc4b78c464a1ab3102d99114ddfa3fe011e0a6b6ae2076ee46d5d64561604d0b758fae947d22da clapf-0.4.7.4-g31d2ce87967e.tar.gz
096ed4afe1b0fad569a172d6af952f1590d230dd38f6f0c4c0b1e7f29a1515fd887f1c099267aa926ce698864b75cb50626a9b7f49914549748d22ba7058a31d gsl-libs.patch
18b8bf55f20e86e05958f2b4a8bdea8bedeb712bc91bb9a6a67faa2928b545707d3391671ab843415fe11703fef4683594571136cf9b2ec87aa41b0875d34588 def__user.patch
-d71081b2f1bdc9f44ee5cee6e4149e6e53d5ef5415069814dd22d9c2df6eee0195b9e3466468d01d0b5bcfadfc20ec0eacfd1299d5f37cbe7f326ffab435972b ldflags.patch
-99795b8063234c5dbf10da145660c39dfe3f121aa4bb17869abc0dcab5dfd765bfba033a701c8b70d57cb4fe2811d122da1e56506a1c45c0afdcc2102719d798 clapf.confd
-08e42083bcdfe39099d78db23961c0585883cfb3ad4b789376ca34d1d89556dbae153eeda281f08ffe179a4305188062c03ed1a53ca98d636c44ddbd7b40112a clapf.initd"
+f391663c74ce55b33446bbca9cde61201147d8704f514a266ea1371a43231e34800a8dc6e9f3843849ac000aa49ec2cffc023795696b6127bb404df83493f10f ldflags.patch
+f9d931f59710ca5ffae2d08d95d12d090dbbd932f8aa0ebb15e925704563834249e475e7ae8e845fb0f57396cdc11492b54efa0f5c228222f04a0e0c0e92caa5 clapf.confd
+c4dff1a3627f9de640dbe6c9a7c69f0e8357f9c63a3fb41f3c6c1e7ee6caec431be6f473002847f1fd2c6c41f7d2730ae134a5b04c9df77502b0905657f524e8 clapf.initd"
diff --git a/testing/clapf/clapf.confd b/testing/clapf/clapf.confd
index f31009d75d..8edf00cfb2 100644
--- a/testing/clapf/clapf.confd
+++ b/testing/clapf/clapf.confd
@@ -1,4 +1,6 @@
-#
-# Config file for /etc/init.d/clapf
-#
-TMPDIR="/var/lib/clapf"
+# /etc/conf.d/clapf: config file for /etc/init.d/clapf
+
+#CLAPF_USER=clapf
+#CLAPF_GROUP=clapf
+#CLAPF_CONF=/etc/clapf.conf
+#CLAPF_OPTS="-c $CLAPF_CONF"
diff --git a/testing/clapf/clapf.initd b/testing/clapf/clapf.initd
index eaf2aa49e3..b3e6c6dd90 100644
--- a/testing/clapf/clapf.initd
+++ b/testing/clapf/clapf.initd
@@ -1,23 +1,27 @@
-#!/sbin/runscript
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header:
+#!/sbin/openrc-run
+
+description="Email content filter"
+extra_started_commands="reload"
+
+command="/usr/sbin/clapf"
+pidfile="/var/run/clapf/clapf.pid"
+CLAPF_CONF="${CLAPF_CONF:-/etc/clapf.conf}"
+CLAPF_USER="${CLAPF_USER:-clapf}"
+CLAPF_GROUP="${CLAPF_GROUP:-clapf}"
+command_user="$CLAPF_USER${CLAPF_GROUP:+:}$CLAPF_GROUP"
+command_args="${CLAPF_OPTS:--c $CLAPF_CONF}"
+command_background="YES"
depend() {
need net
- use logger
+ use logger
before mta
}
-start() {
- ebegin "Starting clapf"
- start-stop-daemon --start --quiet --user clapf --background \
- --exec /usr/sbin/clapf --make-pidfile --pid /var/run/clapf/clapf.pid -- -c /etc/clapf.conf
- eend $?
-}
-
-stop() {
- ebegin "Stopping clapf"
- start-stop-daemon --stop --quiet --pidfile /var/run/clapf/clapf.pid
+reload() {
+ ebegin "Reloading ${name:-$RC_SVCNAME}"
+ start-stop-daemon --signal HUP \
+ ${command:+--exec} $command \
+ ${pidfile:+--pidfile} $pidfile
eend $?
}
diff --git a/testing/clapf/clapf.pre-install b/testing/clapf/clapf.pre-install
index 7cbfaad04b..b2207408ad 100644
--- a/testing/clapf/clapf.pre-install
+++ b/testing/clapf/clapf.pre-install
@@ -1,6 +1,6 @@
#!/bin/sh
-addgroup -S clamav 2>/dev/null
-adduser -S -D -H -s /bin/false -G clamav -g clamav clamav 2>/dev/null
+addgroup -S clapf 2>/dev/null
+adduser -S -D -H -h /var/lib/clapf -s /bin/false -G clapf -g clapf clapf 2>/dev/null
exit 0
diff --git a/testing/clapf/ldflags.patch b/testing/clapf/ldflags.patch
index 1f5a76d9de..0dfd02de6a 100644
--- a/testing/clapf/ldflags.patch
+++ b/testing/clapf/ldflags.patch
@@ -23,7 +23,7 @@ index 9512aca..6b4388e 100644
ranlib libclapf.a
- #$(CC) -shared -Wl,-soname,libclapf.so.$(CLAPF_VERSION) -o libclapf.so.$(LIBCLAPF_VERSION) $(OBJS) $(SQL_OBJS) $(LIBS) $(LDAP_LIBS) @LDFLAGS@
- $(CC) -shared -Wl -o libclapf.so.$(LIBCLAPF_VERSION) $(OBJS) $(SQL_OBJS) $(LIBS) $(LDAP_LIBS) @LDFLAGS@
-+ $(CC) @LDFLAGS@ -shared -o libclapf.so.$(LIBCLAPF_VERSION) $(OBJS) $(SQL_OBJS) $(LIBS) $(LDAP_LIBS)
++ $(CC) @LDFLAGS@ -shared -Wl,-soname,libclapf.so.$(CLAPF_VERSION) -o libclapf.so.$(LIBCLAPF_VERSION) $(OBJS) $(SQL_OBJS) $(LIBS) $(LDAP_LIBS)
ln -sf libclapf.so.$(LIBCLAPF_VERSION) libclapf.so
ln -sf libclapf.so.$(LIBCLAPF_VERSION) libclapf.so.$(CLAPF_VERSION)