From 622de23541903f9b6f85fe0a96d61de08372d23b Mon Sep 17 00:00:00 2001 From: root Date: Fri, 10 Jun 2011 17:00:28 +0000 Subject: Fri Jun 10 17:00:28 UTC 2011 --- extra/clamav/PKGBUILD | 35 +++++++++++++----------- extra/clamav/conf.d | 8 ++++++ extra/clamav/install | 14 ++++++++++ extra/clamav/logrotate | 8 ++++++ extra/clamav/rc.d | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 122 insertions(+), 15 deletions(-) create mode 100644 extra/clamav/conf.d create mode 100644 extra/clamav/install create mode 100644 extra/clamav/logrotate create mode 100644 extra/clamav/rc.d (limited to 'extra/clamav') diff --git a/extra/clamav/PKGBUILD b/extra/clamav/PKGBUILD index 983458e51..35dc54939 100644 --- a/extra/clamav/PKGBUILD +++ b/extra/clamav/PKGBUILD @@ -1,35 +1,40 @@ -# $Id: PKGBUILD 109346 2011-02-08 18:56:38Z bisson $ -# Maintainer: Dale Blount +# $Id: PKGBUILD 127029 2011-06-09 21:38:42Z bisson $ +# Contributor: Dale Blount # Contributor: Gregor Ibic +# Maintainer: Gaetan Bisson pkgname=clamav -pkgver=0.97 +pkgver=0.97.1 pkgrel=1 pkgdesc='Anti-virus toolkit for Unix' arch=('i686' 'x86_64') depends=('bzip2' 'zlib' 'libtool') options=('!libtool') -install="$pkgname.install" license=('GPL') backup=('etc/clamav/clamd.conf' 'etc/clamav/freshclam.conf' 'etc/conf.d/clamav') url='http://www.clamav.net/' source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz" - 'clamav' - 'clamav.confd' - 'clamav.logrotate' + 'rc.d' + 'conf.d' + 'logrotate' 'config.patch') - -sha1sums=('68f5a6736b3f67d608c4064ef839777877f09115' +sha1sums=('1b3a4667dcc278bc7eab38acbc0f35269aa05387' '7f15f0b13a1c11235bc99ef0add01efd8a442f07' 'cb116cdab49a810381a515cbcfb6a6c148547f07' 'be3310d2b41a68ce06e33c84ab68ffe59fdce104' '701a61571788d10ff7af01597785835c6bfea918') +install=install + build() { cd "$srcdir/$pkgname-$pkgver" patch -p1 < ../config.patch - ./configure --prefix=/usr --sysconfdir=/etc/clamav \ - --with-dbdir=/var/lib/clamav --disable-clamav + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc/clamav \ + --with-dbdir=/var/lib/clamav \ + --disable-clamav \ + make } @@ -37,14 +42,14 @@ package() { cd "$srcdir/$pkgname-$pkgver" make DESTDIR="$pkgdir" install - # make sure conf files get installed, cause make install + # make sure conf files get installed, because make install # doesn't do that if clamav is already installed upon building. install -D -m644 etc/clamd.conf "$pkgdir/etc/clamav/clamd.conf" install -D -m644 etc/freshclam.conf "$pkgdir/etc/clamav/freshclam.conf" - install -D -m644 ../clamav.logrotate "$pkgdir/etc/logrotate.d/clamav" - install -D -m644 ../clamav.confd "$pkgdir/etc/conf.d/clamav" - install -D -m755 ../clamav "$pkgdir/etc/rc.d/clamav" + install -D -m644 ../logrotate "$pkgdir/etc/logrotate.d/clamav" + install -D -m644 ../conf.d "$pkgdir/etc/conf.d/clamav" + install -D -m755 ../rc.d "$pkgdir/etc/rc.d/clamav" # un-distribute databases to require freshclam rm "$pkgdir"/var/lib/clamav/*.cvd diff --git a/extra/clamav/conf.d b/extra/clamav/conf.d new file mode 100644 index 000000000..9cd44d9f8 --- /dev/null +++ b/extra/clamav/conf.d @@ -0,0 +1,8 @@ +# clamav startup script config options + +# change these to "yes" to start +START_FRESHCLAM="no" +START_CLAMD="no" + +# Options to pass to freshclam (man freshclam for more info). +FRESHCLAM_OPTS="-c 12" diff --git a/extra/clamav/install b/extra/clamav/install new file mode 100644 index 000000000..9116dc394 --- /dev/null +++ b/extra/clamav/install @@ -0,0 +1,14 @@ +post_install() { + getent group clamav &>/dev/null || groupadd -r -g 64 clamav >/dev/null + getent passwd clamav &>/dev/null || useradd -r -u 64 -g clamav -d /dev/null -s /bin/false -c "Clam AntiVirus" clamav >/dev/null + + install -d /var/{log,run}/clamav + chown clamav:root /var/{log,run}/clamav + chown -R clamav:clamav /var/lib/clamav +} + +post_remove() { + getent passwd clamav &>/dev/null && userdel clamav >/dev/null + getent group clamav &>/dev/null && groupdel clamav >/dev/null + return 0 +} diff --git a/extra/clamav/logrotate b/extra/clamav/logrotate new file mode 100644 index 000000000..d1dc94dce --- /dev/null +++ b/extra/clamav/logrotate @@ -0,0 +1,8 @@ +/var/log/clamav/clamd.log /var/log/clamav/freshclam.log { + create 644 clamav clamav + sharedscripts + postrotate + /bin/kill -HUP `cat /var/run/clamav/clamd.pid 2>/dev/null` 2> /dev/null || true + /bin/kill -HUP `cat /var/run/clamav/freshclam.pid 2>/dev/null` 2> /dev/null || true + endscript +} diff --git a/extra/clamav/rc.d b/extra/clamav/rc.d new file mode 100644 index 000000000..8e9c6afa9 --- /dev/null +++ b/extra/clamav/rc.d @@ -0,0 +1,72 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +# source application-specific settings +[ -f /etc/conf.d/clamav ] && . /etc/conf.d/clamav + +PID_FC=`pidof -o %PPID /usr/bin/freshclam` +PID_CD=`pidof -o %PPID /usr/sbin/clamd` + +case "$1" in + start) + # if clamd isn't started first, notifyclamd fails at times + if [ "$START_CLAMD" == "yes" ]; then + stat_busy "Starting ClamD" + [ -z "$PID_CD" ] && /usr/sbin/clamd + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon clamav + stat_done + fi + fi + + # give clamd enough time to start + sleep 1 + + if [ "$START_FRESHCLAM" == "yes" ]; then + stat_busy "Starting FreshClam" + [ -z "$PID_FC" ] && /usr/bin/freshclam -p /var/run/clamav/freshclam.pid -d $FRESHCLAM_OPTS + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon clamav + stat_done + fi + fi + ;; + stop) + if [ "$START_CLAMD" == "yes" ]; then + stat_busy "Stopping ClamD" + [ -n "$PID_CD" ] && kill $PID_CD &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon clamav + stat_done + fi + fi + + if [ "$START_FRESHCLAM" == "yes" ]; then + stat_busy "Stopping FreshClam" + [ -n "$PID_FC" ] && kill $PID_FC &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon clamav + stat_done + fi + fi + ;; + restart) + $0 stop + # will not start if not fully stopped, so sleep + sleep 2 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 -- cgit v1.2.3-54-g00ecf