1 # $Id: PKGBUILD,v 1.45 2007/12/17 21:42:05 tom Exp $
2 # Maintainer: Marco Maso <demind@gmail.org>
3 # Contributor: Gregor Ibic <gregor.ibic@intelicom.si>
4 # Contributor: wido <widomaker2k7@gmail.com>
10 pkgdesc="Anti-virus toolkit for Unix, GIT version."
11 arch=('i686' 'x86_64')
12 depends=('bzip2' 'zlib' 'gmp' 'curl' 'perl')
13 conflicts=('clamav' 'clamav-devel')
15 install=$pkgname.install
17 backup=(etc/clamav/clamav.conf etc/clamav/clamd.conf etc/clamav/freshclam.conf etc/conf.d/clamav)
18 url=("http://www.clamav.net")
23 md5sums=('4be868f0845b859479ec954ff0ddd930'
24 '4c5fe97a8df3af5876246da388b5c7ba'
25 '413bd6c865200eae42a10618f26dc124')
27 _gitroot="git://git.clamav.net/git/clamav-devel"
28 _gitname="clamav-devel"
31 msg "Connecting to gitorious.org GIT server...."
33 if [ -d $srcdir/$_gitname ] ; then
34 cd $_gitname && git pull origin
35 msg "The local files are updated."
40 msg "GIT checkout done or server timeout"
41 msg "Starting make..."
43 rm -rf $srcdir/$_gitname-build
44 cp -r $srcdir/$_gitname $srcdir/$_gitname-build
45 cd $srcdir/$_gitname-build
47 ./configure --prefix=/usr --sysconfdir=/etc/clamav \
48 --with-dbdir=/var/lib/clamav
49 # will add clamav user with clamav.install
51 make DESTDIR=$startdir/pkg install || return 1
53 # make sure conf files get installed, cause make install
54 # doesn't do that if clamav is already installed upon building.
55 for i in clamd freshclam; do
56 install -D -m644 etc/$i.conf $startdir/pkg/etc/clamav/$i.conf
59 install -D -m644 $startdir/src/clamav.confd $startdir/pkg/etc/conf.d/clamav
60 install -D -m755 $startdir/src/clamav $startdir/pkg/etc/rc.d/clamav
61 install -D -m644 $startdir/src/clamav.logrotate $startdir/pkg/etc/logrotate.d/clamav
63 # create log dirs/files & fix conf files.
64 mkdir -p $startdir/pkg/var/log/clamav/
65 mkdir -p $startdir/pkg/var/run/clamav/
66 chown 64.root $startdir/pkg/var/log/clamav/
67 chown 64.root $startdir/pkg/var/run/clamav/
69 sed -i -e "s:\#LogFile /tmp/clamd.log:LogFile /var/log/clamav/clamd.log:" \
70 -e "s:\#PidFile /var/run/clamd.pid:PidFile /var/run/clamav/clamd.pid:" \
71 -e "s:\#User clamav:User clamav:" \
72 -e "s:\#LogTime:LogTime:" \
73 -e "s:\#TemporaryDirectory /var/tmp:TemporaryDirectory /tmp:" \
74 -e "s:\LocalSocket /tmp/clamd.socket:LocalSocket /var/lib/clamav/clamd.sock:" \
75 $startdir/pkg/etc/clamav/clamd.conf || return 1
77 sed -i -e "s:\#UpdateLogFile /var/log/freshclam.log:UpdateLogFile /var/log/clamav/freshclam.log:" \
78 -e "s:\#NotifyClamd /path/to/clamd.conf$:NotifyClamd /etc/clamav/clamd.conf:" \
79 $startdir/pkg/etc/clamav/freshclam.conf || return 1
81 # fix perms on virus database directory and un-distribute databases to require freshclam
82 [ ! -f $startdir/pkg/var/lib/clamav/*.cvd ] || rm $startdir/pkg/var/lib/clamav/*.cvd
83 mkdir -p $startdir/pkg/var/lib/clamav/
84 chown 64:64 -R $startdir/pkg/var/lib/clamav/
87 cd $srcdir/$_gitname-build/contrib/clamdwatch
88 tar zxf clamdwatch.tar.gz
89 sed -i -e 's@/var/run/clamd.ctl@/var/lib/clamav/clamd.sock@' \
90 -e 's@/var/lock/subsys/clamd@/var/run/clamav/clamd.pid@' \
91 -e 's@mkstemp( "/tmp/clamdwatch-XXXXXXXXXXXXXXXX" );@mkstemp( "/tmp/clamdwatch-XXXXXXXXXXXXXXXX" );\nchmod 0644, "$tempFile";@' clamdwatch || return 1
93 install -D -m755 clamdwatch $startdir/pkg/usr/sbin/clamdwatch.pl || return 1