wok annotate clamav/receipt @ rev 24427

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 12 11:42:56 2022 +0000 (2022-02-12)
parents 061d49c68c42
children b01314c762e9
rev   line source
paul@1104 1 # SliTaz package receipt.
paul@1104 2
paul@1104 3 PACKAGE="clamav"
Hans-G?nter@24406 4 VERSION="0.104.2"
paul@1104 5 CATEGORY="security"
Hans-G?nter@20789 6 TAGS="antivirus"
paul@1341 7 SHORT_DESC="Antivirus."
paul@1104 8 MAINTAINER="paul@slitaz.org"
pascal@16051 9 LICENSE="GPL2"
Hans-G?nter@24406 10 WEB_SITE="https://www.clamav.net/"
Hans-G?nter@20789 11
paul@1104 12 TARBALL="$PACKAGE-$VERSION.tar.gz"
pascal@20086 13 WGET_URL="${WEB_SITE}downloads/production/$TARBALL"
paul@1104 14
Hans-G?nter@24406 15 DEPENDS="bzip2 gmp libcurl libjson-c libltdl libssl libxml2 ncurses
Hans-G?nter@24406 16 pcre2 slitaz-base-files zlib"
Hans-G?nter@24406 17 BUILD_DEPENDS="bzip2-dev check-dev cmake curl-dev gmp-dev libjson-c-dev
Hans-G?nter@24407 18 libxml2-dev ncurses-dev openssl-dev pcre2-dev py3k zlib-dev"
slaxemulator@10996 19
paul@1104 20 # Rules to configure and make the package.
paul@1104 21 compile_rules()
paul@1104 22 {
Hans-G?nter@24406 23 # export LDFLAGS="$LDFLAGS -ltinfo"
paul@1104 24 # Have to create clamav user/group to be able to compile
Hans-G?nter@24406 25 # adduser -s /bin/false -H -D -u 64 clamav
paul@1104 26
Hans-G?nter@24406 27 # ./configure \
Hans-G?nter@24406 28 # --prefix=/usr \
Hans-G?nter@24406 29 # --sysconfdir=/etc/clamav \
Hans-G?nter@24406 30 # --with-dbdir=/var/lib/clamav \
Hans-G?nter@24406 31 # --with-iconv=no \
Hans-G?nter@24406 32 # --disable-zlib-vcheck \
Hans-G?nter@24406 33 # $CONFIGURE_ARGS &&
Hans-G?nter@24406 34
Hans-G?nter@24406 35 mkdir _build &&
Hans-G?nter@24406 36 cd _build &&
Hans-G?nter@24406 37 cmake .. \
Hans-G?nter@24406 38 -D CMAKE_INSTALL_PREFIX=/usr \
Hans-G?nter@24406 39 -D APP_CONFIG_DIRECTORY=/etc/clamav \
Hans-G?nter@24406 40 -D DATABASE_DIRECTORY=/var/lib/clamav \
Hans-G?nter@24406 41 -D ENABLE_MILTER=OFF \
Hans-G?nter@24406 42 -D ENABLE_STATIC_LIB=ON &&
slaxemulator@15826 43 make &&
Hans-G?nter@24406 44 make install
paul@1104 45 }
paul@1104 46
paul@1104 47 # Rules to gen a SliTaz package suitable for Tazpkg.
paul@1104 48 genpkg_rules()
paul@1104 49 {
Hans-G?nter@24406 50 mkdir -p $fs/etc/clamav
Hans-G?nter@24406 51 mkdir -p $fs/etc/init.d
Hans-G?nter@24406 52 mkdir -p $fs/run/clamav
Hans-G?nter@24406 53 mkdir -p $fs/usr/lib
Hans-G?nter@24406 54 mkdir -p $fs/var/lib/clamav
Hans-G?nter@24406 55 mkdir -p $fs/var/log/clamav
al@18734 56
Hans-G?nter@24406 57 cp -a $install/etc/clamav/clamd.conf* \
Hans-G?nter@24406 58 $fs/etc/clamav/clamd.conf
Hans-G?nter@24406 59 cp -a $install/etc/clamav/freshclam.conf* \
Hans-G?nter@24406 60 $fs/etc/clamav/freshclam.conf
Hans-G?nter@24406 61
Hans-G?nter@24406 62 # Copy daemon from $stuff
Hans-G?nter@24406 63 cp $stuff/daemon-clamd $fs/etc/init.d/clamd
Hans-G?nter@24406 64
Hans-G?nter@24406 65 cp -a $install/usr/bin $fs/usr
Hans-G?nter@24406 66 rm -f $fs/usr/bin/clamav-config
Hans-G?nter@24406 67 cp -a $install/usr/sbin $fs/usr
Hans-G?nter@24406 68
Hans-G?nter@24406 69 # Copy only shared libraries (.so)
Hans-G?nter@24406 70 cp -a $install/usr/lib/*.so* $fs/usr/lib
Hans-G?nter@24406 71
Hans-G?nter@24406 72 # Customize configuration file
Hans-G?nter@24406 73 sed -i -e "s/^Example/#Example/" \
erjo@11931 74 -e "s|^#LogFile /tmp/clamd.log|LogFile /var/log/clamav/clamav.log|" \
paul@16157 75 -e "s|^#PidFile.*|PidFile /run/clamav/clamd.pid|" \
paul@16157 76 -e "s|^#LocalSocket /tmp/clamd.socket|LocalSocket /run/clamav/clamd-socket|" \
erjo@11931 77 $fs/etc/clamav/clamd.conf
paul@1104 78 }
paul@1104 79
paul@1104 80 post_install()
paul@1104 81 {
al@18734 82 local user=clamav
al@18734 83 local group=clamav
al@18734 84
paul@1104 85 # Enable freshclam update
Hans-G?nter@24406 86 echo
Hans-G?nter@24406 87 action 'Enabling freshclam update...'
pascal@18730 88 cd "$1/etc/clamav"
Hans-G?nter@24406 89 sed -i 's/^Example/#Example/' freshclam.conf
paul@1104 90 status
Hans-G?nter@24406 91 [ "$quiet" ] || cat <<EOT
Hans-G?nter@24406 92 Before starting clamd for the first time,
Hans-G?nter@24406 93 create signature database with freshclam."
Hans-G?nter@24406 94 EOT
paul@1104 95
paul@1104 96 # adduser clamav if needed
Hans-G?nter@24406 97 if ! grep -q "${user}:" "$1/etc/passwd"
Hans-G?nter@24406 98 then
Hans-G?nter@24406 99 action 'Adding user and group $user...'
pascal@18730 100 chroot "$1/" addgroup -S $group
pascal@18730 101 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
paul@1104 102 status
paul@1104 103 fi
paul@1595 104
paul@1707 105 # Enable daily.cvd updates (sometimes needed for new version)
pascal@18730 106 #chown -R ${user}:${group} "$1/var/lib/clamav"
al@18734 107
Hans-G?nter@24406 108 # Fix permissions
Hans-G?nter@24406 109 chroot "$1/" chown -R ${user}.${group} /run/clamav
Hans-G?nter@24406 110 chroot "$1/" chown -R ${user}.${group} /var/lib/clamav
Hans-G?nter@24406 111 chroot "$1/" chown -R ${user}.${group} /var/log/clamav
paul@1104 112 }
paul@1104 113
Hans-G?nter@24406 114 # Delete user clamav when package is removed.
paul@1104 115 post_remove()
paul@1104 116 {
al@18734 117 chroot "$1/" deluser clamav
paul@1104 118 }
Hans-G?nter@24409 119