wok-current view clamav/receipt @ rev 11931

clamav: improve package
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Mar 01 02:34:58 2012 +0100 (2012-03-01)
parents d2d3a1cb8911
children 7896f0694ef6
line source
1 # SliTaz package receipt.
3 PACKAGE="clamav"
4 VERSION="0.97.3"
5 CATEGORY="security"
6 SHORT_DESC="Antivirus."
7 MAINTAINER="paul@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.gz"
9 WEB_SITE="http://www.clamav.net/"
10 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
11 TAGS="antivirus"
13 DEPENDS="zlib gmp bzip2 slitaz-base-files ncurses libltdl"
14 BUILD_DEPENDS="zlib-dev gmp gmp-dev bzip2-dev ncurses-dev bash"
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 # Have to create clamav user/group to be able to compile
20 adduser -s /bin/false -H -D clamav
22 cd $src
23 ./configure \
24 --sysconfdir=/etc/clamav \
25 --with-iconv=no \
26 $CONFIGURE_ARGS && make && make install
27 }
29 # Rules to gen a SliTaz package suitable for Tazpkg.
30 genpkg_rules()
31 {
32 mkdir -p $fs/usr/lib $fs/usr/share $fs/etc/init.d \
33 $fs/var/log/clamav $fs/var/run/clamav
34 cp -a $install/usr/bin $fs/usr
35 cp -a $install/usr/sbin $fs/usr
36 cp -a $install/etc $fs
37 # Copy only shared lib (.so)
38 cp -a $install/usr/lib/*.so* $fs/usr/lib
39 cp -a $install/usr/share/clamav $fs/usr/share
40 # Copy daemon from /$stuff
41 cp $stuff/daemon-clamd $fs/etc/init.d/clamd
43 # Customize config
44 sed -i -e "s/^Example/#Example/" \
45 -e "s|^#LogFile /tmp/clamd.log|LogFile /var/log/clamav/clamav.log|" \
46 -e "s|^#PidFile.*|PidFile /var/run/clamav/clamd.pid|" \
47 -e "s|^#LocalSocket /tmp/clamd.socket|LocalSocket /var/run/clamav/clamd.ctl|" \
48 $fs/etc/clamav/clamd.conf
50 }
52 post_install()
53 {
55 local user
56 local group
58 user=clamav
59 group=clamav
61 echo "Processing post-install commands..."
63 # Enable freshclam update
64 echo -n "Enabling freshclam update..."
65 cd $1/etc/clamav
66 sed -i 's/^Example/#Example/' freshclam.conf
67 status
69 # adduser clamav if needed
70 if ! grep -q "${user}:" $1/etc/passwd; then
71 echo -n "Adding user/group $user..."
72 chroot $1/ addgroup -S $group
73 chroot $1/ adduser -s /bin/false -S -D -H -G $group $user
74 status
75 fi
77 # Enable daily.cvd updates (sometimes needed for new version)
78 chown -R ${user}:${group} $1/usr/share/clamav
80 # Fix perms
81 chroot $1/ chown -R ${user}.${group} /var/log/clamav \
82 /var/run/clamav
84 }
86 # Del user clamav when pkg is removed.
87 post_remove()
88 {
89 chroot "$1/" deluser clamav
90 }