PKGBUILDs/extra/clamav/PKGBUILD

72 lines
2.9 KiB
Bash
Raw Normal View History

2009-10-10 02:23:22 +00:00
# $Id: PKGBUILD 46323 2009-07-15 20:34:35Z eric $
# Maintainer: Dale Blount <dale@archlinux.org>
# Contributor: Gregor Ibic <gregor.ibic@intelicom.si>
pkgname=clamav
pkgver=0.95.2
pkgrel=1
pkgdesc="Anti-virus toolkit for Unix."
arch=(i686 x86_64)
depends=('bzip2' 'zlib' 'gmp' 'curl>=7.16.2' 'perl' 'libtool')
options=(!libtool)
install="$pkgname.install"
license=(GPL)
backup=(etc/clamav/clamav.conf 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)
md5sums=('930362397d30e01ba81b5f24c1046d48' '338db2f3fbca9d5747ba635d576d8739'\
'f1fd8e736f808da0487928274f585851' 'a7a4d527ba80ec9d4811e2264e9fab9e')
build() {
cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr --sysconfdir=/etc/clamav \
--with-dbdir=/var/lib/clamav --disable-clamav
# will add clamav user with clamav.install
make || return 1
make DESTDIR="$pkgdir" install || return 1
# make sure conf files get installed, cause make install
# doesn't do that if clamav is already installed upon building.
for i in clamd freshclam; do
install -D -m644 etc/$i.conf "$pkgdir/etc/clamav/$i.conf"
done
install -D -m644 "$srcdir/clamav.confd" "$pkgdir/etc/conf.d/clamav"
install -D -m755 "$srcdir/clamav" "$pkgdir/etc/rc.d/clamav"
install -D -m644 "$srcdir/clamav.logrotate" "$pkgdir/etc/logrotate.d/clamav"
# create log dirs/files & fix conf files.
mkdir -p "$pkgdir/var/log/clamav/"
mkdir -p "$pkgdir/var/run/clamav/"
chown 64.root "$pkgdir/var/log/clamav/"
chown 64.root "$pkgdir/var/run/clamav/"
sed -i -e "s:\#LogFile /tmp/clamd.log:LogFile /var/log/clamav/clamd.log:" \
-e "s:\#PidFile /var/run/clamd.pid:PidFile /var/run/clamav/clamd.pid:" \
-e "s:\#User clamav:User clamav:" \
-e "s:\#LogTime:LogTime:" \
-e "s:\#TemporaryDirectory /var/tmp:TemporaryDirectory /tmp:" \
-e "s:\LocalSocket /tmp/clamd.socket:LocalSocket /var/lib/clamav/clamd.sock:" \
"$pkgdir/etc/clamav/clamd.conf" || return 1
sed -i -e "s:\#UpdateLogFile /var/log/freshclam.log:UpdateLogFile /var/log/clamav/freshclam.log:" \
-e "s:\#NotifyClamd /path/to/clamd.conf$:NotifyClamd /etc/clamav/clamd.conf:" \
"$pkgdir/etc/clamav/freshclam.conf" || return 1
# fix perms on virus database directory and un-distribute databases to require freshclam
rm "$pkgdir"/var/lib/clamav/*.cvd
chown 64:64 -R "$pkgdir/var/lib/clamav/"
# install clamdwatch
cd "$srcdir/$pkgname-$pkgver/contrib/clamdwatch"
tar zxf clamdwatch.tar.gz
sed -i -e 's@/tmp/clamd.socket@/var/lib/clamav/clamd.sock@' \
-e 's@/var/lock/subsys/clamd@/var/run/clamav/clamd.pid@' \
-e 's@mkstemp( "/tmp/clamdwatch-XXXXXXXXXXXXXXXX" );@mkstemp( "/tmp/clamdwatch-XXXXXXXXXXXXXXXX" );\nchmod 0644, "$tempFile";@' clamdwatch || return 1
install -D -m755 clamdwatch "$pkgdir/usr/sbin/clamdwatch.pl" || return 1
}