wok annotate clamav/receipt @ rev 17409

Up tazlito (5.2.5)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Nov 28 21:49:51 2014 +0100 (2014-11-28)
parents b97997359190
children 17e313b5b9c1
rev   line source
paul@1104 1 # SliTaz package receipt.
paul@1104 2
paul@1104 3 PACKAGE="clamav"
pascal@16051 4 VERSION="0.98.1"
paul@1104 5 CATEGORY="security"
paul@1341 6 SHORT_DESC="Antivirus."
paul@1104 7 MAINTAINER="paul@slitaz.org"
pascal@16051 8 LICENSE="GPL2"
paul@1104 9 TARBALL="$PACKAGE-$VERSION.tar.gz"
paul@1104 10 WEB_SITE="http://www.clamav.net/"
slaxemulator@7479 11 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
jozee@4933 12 TAGS="antivirus"
paul@1104 13
slaxemulator@10996 14 DEPENDS="zlib gmp bzip2 slitaz-base-files ncurses libltdl"
slaxemulator@10996 15 BUILD_DEPENDS="zlib-dev gmp gmp-dev bzip2-dev ncurses-dev bash"
slaxemulator@10996 16
paul@1104 17 # Rules to configure and make the package.
paul@1104 18 compile_rules()
paul@1104 19 {
paul@1104 20 # Have to create clamav user/group to be able to compile
slaxemulator@15826 21 adduser -s /bin/false -H -D -u 64 clamav
paul@1104 22
paul@1104 23 cd $src
paul@1104 24 ./configure \
paul@16157 25 --prefix=/usr \
paul@1104 26 --sysconfdir=/etc/clamav \
paul@16157 27 --with-dbdir=/var/lib/clamav \
pascal@3076 28 --with-iconv=no \
slaxemulator@15826 29 $CONFIGURE_ARGS &&
slaxemulator@15826 30 make &&
slaxemulator@15826 31 make DESTDIR=$DESTDIR install
paul@1104 32 }
paul@1104 33
paul@1104 34 # Rules to gen a SliTaz package suitable for Tazpkg.
paul@1104 35 genpkg_rules()
paul@1104 36 {
paul@16157 37 mkdir -p $fs/usr/lib $fs/etc/init.d $fs/var/lib/clamav \
paul@16157 38 $fs/var/log/clamav $fs/run/clamav
erjo@11931 39 cp -a $install/usr/bin $fs/usr
slaxemulator@15826 40 rm -f $fs/usr/bin/clamav-config
erjo@11931 41 cp -a $install/usr/sbin $fs/usr
erjo@11931 42 cp -a $install/etc $fs
pascal@16052 43 mv $fs/etc/clamav/clamd.conf* $fs/etc/clamav/clamd.conf
pascal@16052 44 mv $fs/etc/clamav/freshclam.conf* $fs/etc/clamav/freshclam.conf
paul@1104 45 # Copy only shared lib (.so)
erjo@11931 46 cp -a $install/usr/lib/*.so* $fs/usr/lib
pankso@9697 47 # Copy daemon from /$stuff
pankso@9697 48 cp $stuff/daemon-clamd $fs/etc/init.d/clamd
erjo@11931 49
erjo@11931 50 # Customize config
erjo@11931 51 sed -i -e "s/^Example/#Example/" \
erjo@11931 52 -e "s|^#LogFile /tmp/clamd.log|LogFile /var/log/clamav/clamav.log|" \
paul@16157 53 -e "s|^#PidFile.*|PidFile /run/clamav/clamd.pid|" \
paul@16157 54 -e "s|^#LocalSocket /tmp/clamd.socket|LocalSocket /run/clamav/clamd-socket|" \
erjo@11931 55 $fs/etc/clamav/clamd.conf
erjo@11931 56
paul@1104 57 }
paul@1104 58
paul@1104 59 post_install()
paul@1104 60 {
erjo@11931 61
erjo@11931 62 local user
erjo@11931 63 local group
erjo@11931 64
erjo@11931 65 user=clamav
erjo@11931 66 group=clamav
erjo@11931 67
paul@1104 68 echo "Processing post-install commands..."
paul@1104 69
paul@1104 70 # Enable freshclam update
paul@1104 71 echo -n "Enabling freshclam update..."
pascal@1137 72 cd $1/etc/clamav
paul@5652 73 sed -i 's/^Example/#Example/' freshclam.conf
paul@1104 74 status
paul@1104 75
paul@1104 76 # adduser clamav if needed
erjo@11931 77 if ! grep -q "${user}:" $1/etc/passwd; then
erjo@11931 78 echo -n "Adding user/group $user..."
erjo@11931 79 chroot $1/ addgroup -S $group
erjo@11931 80 chroot $1/ adduser -s /bin/false -S -D -H -G $group $user
paul@1104 81 status
paul@1104 82 fi
paul@1595 83
paul@1707 84 # Enable daily.cvd updates (sometimes needed for new version)
paul@16157 85 #chown -R ${user}:${group} $1/var/lib/clamav
erjo@11931 86
erjo@11931 87 # Fix perms
erjo@11931 88 chroot $1/ chown -R ${user}.${group} /var/log/clamav \
paul@16157 89 /run/clamav /var/lib/clamav
erjo@11931 90
paul@1104 91 }
paul@1104 92
paul@1104 93 # Del user clamav when pkg is removed.
paul@1104 94 post_remove()
paul@1104 95 {
slaxemulator@10996 96 chroot "$1/" deluser clamav
paul@1104 97 }
paul@1104 98