# Contributor: Carlo Landmeter # Maintainer: Carlo Landmeter pkgname=clamav pkgver=0.97.6 pkgrel=0 pkgusers="clamav" pkggroups="clamav" pkgdesc="An anti-virus toolkit for UNIX" url="http://www.clamav.net/" arch="all" license="GPL" depends="$pkgname-scanner $pkgname-daemon" install="freshclam.pre-install clamav-daemon.pre-install clamav-daemon.pre-upgrade" makedepends="ncurses-dev zlib-dev bzip2-dev" subpackages="$pkgname-doc $pkgname-dev $pkgname-lib $pkgname-libunrar $pkgname-daemon $pkgname-scanner $pkgname-db freshclam" source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz http://db.local.clamav.net/main.cvd http://db.local.clamav.net/daily.cvd clamd.initd clamd.confd freshclam.initd freshclam.confd clamav-0.95.1-nls.patch clamd.logrotate freshclam.logrotate " _builddir="$srcdir/$pkgname-$pkgver" prepare() { cd "$_builddir" patch -p0 -i "$srcdir/clamav-0.95.1-nls.patch" || return 1 } build() { cd "$_builddir" ./configure --prefix=/usr \ --libdir=/usr/lib \ --sysconfdir=/etc/clamav \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --without-iconv \ --disable-llvm \ --with-user=clamav \ --with-group=clamav \ --with-dbdir=/var/lib/clamav \ --enable-clamdtop make || return 1 } package() { cd "$_builddir" make DESTDIR="$pkgdir" install || return 1 rm "$pkgdir"/usr/lib/*.la || return 1 # set proper defaults sed -i -e "s:^\(Example\):\# \1:" \ -e "s:.*\(PidFile\) .*:\1 /var/run/clamav/freshclam.pid:" \ -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \ -e "s:^\#\(UpdateLogFile\) .*:\1 /var/log/clamav/freshclam.log:" \ -e "s:^\#\(NotifyClamd\).*:\1 /etc/clamav/clamd.conf:" \ -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \ -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \ "$pkgdir"/etc/clamav/freshclam.conf # set proper defaults sed -i -e "s:^\(Example\):\# \1:" \ -e "s:.*\(PidFile\) .*:\1 /var/run/clamav/clamd.pid:" \ -e "s:.*\(LocalSocket\) .*:\1 /var/run/clamav/clamd.sock:" \ -e "s:.*\(User\) .*:\1 clamav:" \ -e "s:^\#\(LogFile\) .*:\1 /var/log/clamav/clamd.log:" \ -e "s:^\#\(LogTime\).*:\1 yes:" \ -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \ "$pkgdir"/etc/clamav/clamd.conf } lib() { pkgdesc="ClamAV library" depends="" replaces="clamav" mkdir -p "$subpkgdir"/usr/lib mv "$pkgdir"/usr/lib/libclamav.so.* \ "$subpkgdir"/usr/lib/ } libunrar() { pkgdesc="ClamAV unrar libraries" depends="" replaces="clamav" mkdir -p "$subpkgdir"/usr/lib mv "$pkgdir"/usr/lib/libclamunrar* \ "$subpkgdir"/usr/lib/ } freshclam() { pkgdesc="Auto-updater for the Clam Antivirus scanner data-files" depends="logrotate" replaces="clamav clamav-db" mkdir -p "$subpkgdir"/usr/bin \ "$subpkgdir"/etc/init.d \ "$subpkgdir"/etc/conf.d \ "$subpkgdir"/etc/clamav mv "$pkgdir"/usr/bin/freshclam "$subpkgdir"/usr/bin || return 1 mv "$pkgdir"/etc/clamav/freshclam.conf \ "$subpkgdir"/etc/clamav/ || return 1 install -d -m755 -o clamav -g clamav \ "$subpkgdir"/var/run/clamav \ "$subpkgdir"/var/log/clamav \ "$subpkgdir"/var/lib/clamav || return 1 install -m755 -D "$srcdir"/freshclam.initd \ "$subpkgdir"/etc/init.d/freshclam || return 1 install -m644 -D "$srcdir"/freshclam.confd \ "$subpkgdir"/etc/conf.d/freshclam || return 1 install -m644 -D "$srcdir"/freshclam.logrotate \ "$pkgdir"/etc/logrotate.d/freshclam || return 1 } db() { pkgdesc="ClamAV virus database" replaces="clamav" depends="freshclam" mkdir -p "$subpkgdir"/var/lib/ \ "$subpkgdir"/usr/bin \ "$subpkgdir"/etc/clamav \ "$subpkgdir"/var/run/clamav \ "$subpkgdir"/var/log/clamav \ "$subpkgdir"/var/lib/clamav \ || return 1 chown -R clamav:clamav "$subpkgdir"/var/lib/clamav install -m 0644 "$srcdir"/*.cvd "$subpkgdir"/var/lib/clamav/ || return 1 } scanner() { pkgdesc="ClamAV command-line scanner and utils" replaces="clamav" depends="freshclam" mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/clamscan \ "$subpkgdir"/usr/bin/ || return 1 mv "$pkgdir"/usr/bin/sigtool \ "$subpkgdir"/usr/bin/ || return 1 mv "$pkgdir"/usr/bin/clambc \ "$subpkgdir"/usr/bin/ || return 1 } daemon() { pkgdesc="ClamAV daemon scanner" replaces="clamav" depends="freshclam logrotate" mkdir -p "$subpkgdir"/usr/bin \ "$subpkgdir"/usr/sbin \ "$subpkgdir"/etc/clamav \ || return 1 install -d -m 755 -o clamav -g clamav \ "$subpkgdir"/var/run/clamav \ "$subpkgdir"/var/log/clamav \ "$subpkgdir"/var/lib/clamav mv "$pkgdir"/usr/bin/clamconf \ "$subpkgdir"/usr/bin/ || return 1 mv "$pkgdir"/usr/sbin/clamd \ "$subpkgdir"/usr/sbin/ || return 1 mv "$pkgdir"/usr/bin/clamdtop \ "$subpkgdir"/usr/bin/ || return 1 mv "$pkgdir"/usr/bin/clamdscan \ "$subpkgdir"/usr/bin/ || return 1 mv "$pkgdir"/etc/clamav/clamd.conf \ "$subpkgdir"/etc/clamav/ || return 1 install -m755 -D "$srcdir"/clamd.initd \ "$subpkgdir"/etc/init.d/clamd || return 1 install -m644 -D "$srcdir"/clamd.confd \ "$subpkgdir"/etc/conf.d/clamd || return 1 install -m644 -D "$srcdir"/clamd.logrotate \ "$pkgdir"/etc/logrotate.d/clamd || return 1 } md5sums="1dbdd803b37c0d9d222e4316049f46a2 clamav-0.97.6.tar.gz eb12490fda87d602e476d4b163f8a34b main.cvd d67ee231dc7579968a562160e87b34e3 daily.cvd b4523253843761d7a7e5fa765b3fb2b9 clamd.initd e8a03fad6ce603631e8fe71a24d387c6 clamd.confd 401fe30d9af2fea3151f938b26ff01c0 freshclam.initd e48466ddfb56f66c623b83e58777b778 freshclam.confd 0d08fd29656bd4b018ecf8ce9706ac55 clamav-0.95.1-nls.patch ae1e48ab56a0fff1acdde023c1f6f350 clamd.logrotate 226824214c021b2366f0be1289561d17 freshclam.logrotate"