diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
commit | 415856bdd4f48ab4f2732996f0bae58595092bbe (patch) | |
tree | ede2018b591f6dfb477fe9341ba17b9bc000fab9 /community/dspam |
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'community/dspam')
-rw-r--r-- | community/dspam/PKGBUILD | 68 | ||||
-rw-r--r-- | community/dspam/dspam | 37 | ||||
-rw-r--r-- | community/dspam/dspam.install | 33 | ||||
-rw-r--r-- | community/dspam/dspam.logrotated | 5 |
4 files changed, 143 insertions, 0 deletions
diff --git a/community/dspam/PKGBUILD b/community/dspam/PKGBUILD new file mode 100644 index 000000000..9da467697 --- /dev/null +++ b/community/dspam/PKGBUILD @@ -0,0 +1,68 @@ +# $Id: PKGBUILD 44186 2011-04-04 13:07:03Z spupykin $ +# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com> +# Contributor: William Rea <sillywilly@gmail.com> + +pkgname=dspam +pkgver=3.9.0 +pkgrel=4 +pkgdesc="A scalable, open-source statistical anti-spam filter" +arch=('i686' 'x86_64') +url="http://dspam.nuclearelephant.com/" +options=('!libtool') +backup=(etc/dspam/dspam.conf) +license=("GPL") +depends=(readline libcap ncurses zlib openssl) +makedepends=('libmysqlclient' 'postgresql-libs' 'db' 'sqlite3') +optdepends=('libmysqlclient: MySQL support' + 'postgresql-libs: PostgreSQL support' + 'db: BerkeleyDB support' + 'sqlite3: SQLite support') +options=('zipman' 'docs' '!libtool') +source=(http://downloads.sourceforge.net/project/dspam/dspam/dspam-$pkgver/dspam-$pkgver.tar.gz + dspam.logrotated + dspam) +install=$pkgname.install +md5sums=('10d092b57d628d8c91655fee5dc0d0cd' + '2163ca41de383f09f4d754e2d35cb158' + 'bb2300eff5b2a6eb987750c71a2c2169') + +build() { + OPTS="--enable-delivery-to-stdout --with-dspam-owner=dspam --with-dspam-group=dspam --enable-daemon --enable-virtual-users \ + --with-mysql-includes=/usr/include/mysql --with-mysql-libraries=/usr/lib \ + --with-storage-driver="mysql_drv,libdb4_drv,pgsql_drv,sqlite3_drv,hash_drv" --with-dspam-home=/var/lib/dspam \ + --with-logdir=/var/log/dspam --enable-preferences-extension --enable-large-scale" + + cd $srcdir/$pkgname-$pkgver + [ $NOEXTRACT -eq 1 ] || ./configure --prefix=/usr --sysconfdir=/etc/dspam --localstatedir=/var ${OPTS} + make -j1 +} +package() { + cd $srcdir/$pkgname-$pkgver + make DESTDIR=$pkgdir install + + mkdir -p $pkgdir/srv/http/dspam + cp -a webui/* $pkgdir/srv/http/dspam/ + find $pkgdir/srv/http/dspam/ -type f -name 'Makefile*' -exec rm -f {} \; + find $pkgdir/srv/http/dspam/ -type f -name '*.in' -exec rm -f {} \; + + install -d $pkgdir/etc/logrotate.d \ + $pkgdir/etc/rc.d $pkgdir/var/lib/dspam/{mysql,pgsql} + install -m644 ../dspam.logrotated $pkgdir/etc/logrotate.d + install -m755 ../dspam $pkgdir/etc/rc.d + + sed -i 's|#ServerPID|ServerPID|' $pkgdir/etc/dspam/dspam.conf + + sed -e 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/var/run/dspam/dspam.sock\":gI' \ + -e 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/var/run/dspam/dspam.pid:gI' \ + -i $pkgdir/etc/dspam/dspam.conf + + sed -i 's|/var/lib/mysql/mysql.sock|/tmp/mysql.sock|' $pkgdir/etc/dspam/dspam.conf + + cp -r src/tools.mysql_drv/*.sql $pkgdir/var/lib/dspam/mysql + cp -r src/tools.pgsql_drv/*.sql $pkgdir/var/lib/dspam/pgsql + + cd $pkgdir/usr/share/man/man3 + find -type l -exec ln -sf libdspam.3 {} \; + + chmod 0755 $pkgdir/usr/bin/* +} diff --git a/community/dspam/dspam b/community/dspam/dspam new file mode 100644 index 000000000..be533ba5f --- /dev/null +++ b/community/dspam/dspam @@ -0,0 +1,37 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/bin/dspam` +case "$1" in + start) + stat_busy "Starting DSPAM Daemon" + [ -d /var/run/dspam ] || mkdir -p /var/run/dspam + [ -z "$PID" ] && /usr/bin/dspam --daemon &> /dev/null & + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon dspam + stat_done + fi + ;; + stop) + stat_busy "Stopping DSPAM Daemon" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon dspam + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/community/dspam/dspam.install b/community/dspam/dspam.install new file mode 100644 index 000000000..fc74fe55e --- /dev/null +++ b/community/dspam/dspam.install @@ -0,0 +1,33 @@ +post_install() { + echo -n "adding dspam system group... " + groupadd -g 115 dspam && echo "done." + echo -n "adding dspam system user... " + useradd -c "DSPAM Daemon" -u 115 -d /var/lib/dspam -g dspam -s /bin/false dspam \ + && echo "done." + passwd -l dspam &>/dev/null + +cat << EOF +>>> To populate the DSPAM database, you need to follow several steps. +>>> First create a database. Login to the mysql command prompt. + $ mysql -u root -p + mysql> CREATE database dspam; +>>> Next, you need to create a dspam user. At the same MySQL prompt: + mysql> GRANT ALL PRIVILEGES ON dspam.* TO dspam@'localhost' IDENTIFIED BY 'passwd'; +>>> Replacing passwd with your chosen password. +>>> If you want a space optimized db do: + $ mysql -u dspam dspam -p < /var/lib/dspam/mysql/mysql_objects-space.sql +>>> If you want a speed optimized db do: + $ mysql -u dspam dspam -p < /var/lib/dspam/mysql/mysql_objects-speed.sql +>>> Enter the password you set in the previous step, and the database should be populated. + +>>> Remember to edit /etc/dspam/dspam.conf accordenly +>>> If you want to use the postgresql, sqlite3 or Berekely DB4 backends, +>>> read the documentation +>>> +EOF +} + +post_remove() { + echo -n -e "\nremoving dspam system user and group..." + userdel dspam && echo "done." +} diff --git a/community/dspam/dspam.logrotated b/community/dspam/dspam.logrotated new file mode 100644 index 000000000..89db6f565 --- /dev/null +++ b/community/dspam/dspam.logrotated @@ -0,0 +1,5 @@ +/var/log/dspam/sql.errors /var/log/dspam/system.log /var/log/dspam/dspam.debug /var/log/dspam/dspam.messages { + weekly + compress + create 0644 dspam dspam +} |