wok-current view clamav/receipt @ rev 25672
patch tazpkg, upgrade core pkgs first
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Sun Mar 03 17:58:42 2024 +0000 (5 months ago) |
parents | 097600d80931 |
children |
line source
1 # SliTaz package receipt.
3 PACKAGE="clamav"
4 VERSION="0.104.2"
5 CATEGORY="security"
6 TAGS="antivirus"
7 SHORT_DESC="Antivirus."
8 MAINTAINER="paul@slitaz.org"
9 LICENSE="GPL2"
10 WEB_SITE="https://github.com/Cisco-Talos/clamav"
12 TARBALL="$PACKAGE-$VERSION.tar.gz"
13 WGET_URL="https://www.clamav.net/downloads/production/$TARBALL"
15 DEPENDS="bzip2 gmp libcurl libjson-c libltdl libssl libxml2 ncurses
16 pcre2 slitaz-base-files zlib"
17 BUILD_DEPENDS="bzip2-dev check-dev cmake curl-dev gmp-dev libjson-c-dev
18 libxml2-dev ncurses-dev openssl-dev pcre2-dev python3-dev zlib-dev"
20 # What is the latest version available today?
21 current_version()
22 {
23 wget -O - https://blog.clamav.net/ 2>/dev/null | \
24 sed '/^ClamAV/!d;/ release/!d;/candidate/d;s|and|\n&|' | \
25 sed 's|[^ ]* ||;s| .*||' | sort -Vr | sed q
26 }
28 # Rules to configure and make the package.
29 compile_rules()
30 {
31 # export LDFLAGS="$LDFLAGS -ltinfo"
32 # Have to create clamav user/group to be able to compile
33 # adduser -s /bin/false -H -D -u 64 clamav
35 # ./configure \
36 # --prefix=/usr \
37 # --sysconfdir=/etc/clamav \
38 # --with-dbdir=/var/lib/clamav \
39 # --with-iconv=no \
40 # --disable-zlib-vcheck \
41 # $CONFIGURE_ARGS &&
43 mkdir _build &&
44 cd _build &&
45 cmake .. \
46 -D CMAKE_INSTALL_PREFIX=/usr \
47 -D APP_CONFIG_DIRECTORY=/etc/clamav \
48 -D DATABASE_DIRECTORY=/var/lib/clamav \
49 -D ENABLE_MILTER=OFF \
50 -D ENABLE_STATIC_LIB=ON &&
51 make &&
52 make install
53 }
55 # Rules to gen a SliTaz package suitable for Tazpkg.
56 genpkg_rules()
57 {
58 mkdir -p $fs/etc/clamav
59 mkdir -p $fs/etc/init.d
60 mkdir -p $fs/run/clamav
61 mkdir -p $fs/usr/lib
62 mkdir -p $fs/var/lib/clamav
63 mkdir -p $fs/var/log/clamav
65 cp -a $install/etc/clamav/clamd.conf* \
66 $fs/etc/clamav/clamd.conf
67 cp -a $install/etc/clamav/freshclam.conf* \
68 $fs/etc/clamav/freshclam.conf
70 # Copy daemon from $stuff
71 cp $stuff/daemon-clamd $fs/etc/init.d/clamd
73 cp -a $install/usr/bin $fs/usr
74 rm -f $fs/usr/bin/clamav-config
75 cp -a $install/usr/sbin $fs/usr
77 # Copy only shared libraries (.so)
78 cp -a $install/usr/lib/*.so* $fs/usr/lib
80 # Customize configuration file
81 sed -i -e "s/^Example/#Example/" \
82 -e "s|^#LogFile /tmp/clamd.log|LogFile /var/log/clamav/clamav.log|" \
83 -e "s|^#PidFile.*|PidFile /run/clamav/clamd.pid|" \
84 -e "s|^#LocalSocket /tmp/clamd.socket|LocalSocket /run/clamav/clamd-socket|" \
85 $fs/etc/clamav/clamd.conf
86 }
88 post_install()
89 {
90 local user=clamav
91 local group=clamav
93 # Enable freshclam update
94 echo
95 action 'Enabling freshclam update...'
96 cd "$1/etc/clamav"
97 sed -i 's/^Example/#Example/' freshclam.conf
98 status
99 [ "$quiet" ] || cat <<EOT
100 Before starting clamd for the first time,
101 create signature database with freshclam."
102 EOT
104 # adduser clamav if needed
105 if ! grep -q "${user}:" "$1/etc/passwd"
106 then
107 action 'Adding user and group $user...'
108 chroot "$1/" addgroup -S $group
109 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
110 status
111 fi
113 # Enable daily.cvd updates (sometimes needed for new version)
114 #chown -R ${user}:${group} "$1/var/lib/clamav"
116 # Fix permissions
117 chroot "$1/" chown -R ${user}.${group} /run/clamav
118 chroot "$1/" chown -R ${user}.${group} /var/lib/clamav
119 chroot "$1/" chown -R ${user}.${group} /var/log/clamav
120 }
122 # Delete user clamav when package is removed.
123 post_remove()
124 {
125 chroot "$1/" deluser clamav
126 }