summaryrefslogtreecommitdiffstats
path: root/clamav
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2017-08-07 21:21:09 +0000
committer Eric Hameleers <alien@slackware.com>2017-08-07 21:21:09 +0000
commitdc36c47694dc92c6e3aafa15d045f9a0a963e226 (patch)
treee255b29b823dffb23b3be2c8bb2c88ef85bc0bb2 /clamav
parent65e0d85009bfc0a7c734c4803023739a95efd20b (diff)
downloadasb-dc36c47694dc92c6e3aafa15d045f9a0a963e226.tar.gz
asb-dc36c47694dc92c6e3aafa15d045f9a0a963e226.tar.xz
clamav: updated to 0.99.2
Diffstat (limited to 'clamav')
-rwxr-xr-xclamav/build/clamav.SlackBuild125
1 files changed, 98 insertions, 27 deletions
diff --git a/clamav/build/clamav.SlackBuild b/clamav/build/clamav.SlackBuild
index 6b1b5d7a..1b7d1089 100755
--- a/clamav/build/clamav.SlackBuild
+++ b/clamav/build/clamav.SlackBuild
@@ -1,7 +1,7 @@
#!/bin/sh
# $Id$
-# Copyright 2006-2015 Eric Hameleers, Eindhoven, NL
+# Copyright 2006-2017 Eric Hameleers, Eindhoven, NL
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -148,6 +148,9 @@
# * Update.
# 0.98.7-1: 31/may/2015 by Eric Hameleers
# * Update.
+# 0.99.2-1: 05/aug/2017 by Eric Hameleers
+# * Update. Adopted the enhancements from the SBo copy.
+# Enable milter.
#
# Run 'sh clamav.SlackBuild' to build a Slackware package.
# The package (.tgz) plus descriptive .txt file are created in /tmp .
@@ -158,7 +161,7 @@
# Set initial variables:
PRGNAM=clamav
-VERSION=${VERSION:-"0.98.7"}
+VERSION=${VERSION:-"0.99.2"}
BUILD=${BUILD:-1}
TAG=${TAG:-alien}
@@ -178,7 +181,7 @@ PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-"/tmp"}
SOURCE="$SRCDIR/${PRGNAM}-${VERSION}.tar.gz"
-SRCURL="http://downloads.sourceforge.net/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz"
+SRCURL="http://www.clamav.net/downloads/production/${PRGNAM}-${VERSION}.tar.gz"
##
## --- with a little luck, you won't have to edit below this point --- ##
@@ -204,7 +207,7 @@ if [ -z "$ARCH" ]; then
fi
case "$ARCH" in
- i486) SLKCFLAGS="-O2 -march=i486 -m${MOPT}=i686"
+ i?86) SLKCFLAGS="-O2 -march=${ARCH} -m${MOPT}=i686"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
x86_64) SLKCFLAGS="-O2 -fPIC"
@@ -218,6 +221,11 @@ case "$ARCH" in
;;
esac
+case "$ARCH" in
+ arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
+ *) TARGET=$ARCH-slackware-linux ;;
+esac
+
# Exit the script on errors:
set -e
trap 'echo "$0 FAILED at line $LINENO!" | tee $OUTPUT/error-${PRGNAM}.log' ERR
@@ -270,15 +278,61 @@ echo "++"
cd $TMP/tmp-$PRGNAM
echo "Extracting the source archive(s) for $PRGNAM..."
-tar -xzvf $SOURCE
-
+tar -xvf $SOURCE
cd ${PRGNAM}-${VERSION}
chown -R root:root .
+chmod -R u+w,go+r-w,a+rX-st .
+touch $OUTPUT/patch-${PRGNAM}.log
+
+# Upstream fix:
+cat $SRCDIR/patches/bb111711-fix-zlib-version-check.patch | \
+ patch -p1 --verbose 2>&1 | tee $OUTPUT/patch-${PRGNAM}.log
+
+# Specify the desired mirror in the update config file
+# http://www.iana.org/cctld/cctld-whois.htm
+sed -i "s/^\#DatabaseMirror.*/DatabaseMirror db.${ISOCC}.clamav.net/" \
+ etc/freshclam.conf.sample
+sed \
+ -e "s/^Example/#Example/" \
+ -e "s/^\#LogSyslog/LogSyslog/" \
+ -e "s/^\#LogFacility/LogFacility/" \
+ -e "s/^\#PidFile.*/PidFile \/var\/run\/clamav\/freshclam.pid/" \
+ -e "s/^\#UpdateLogFile.*/UpdateLogFile \/var\/log\/clamav\/freshclam.log/" \
+ -e "s/^\#AllowSupplementaryGroups.*/AllowSupplementaryGroups yes/" \
+ -e "s/^\#DatabaseOwner.*/DatabaseOwner clamav/" \
+ -e "s/^\#NotifyClamd.*/NotifyClamd \/etc\/clamd.conf/" \
+ -i etc/freshclam.conf.sample
+sed \
+ -e "s/^Example/#Example/" \
+ -e "s/^\#LogSyslog/LogSyslog/" \
+ -e "s/^\#LogFacility/LogFacility/" \
+ -e "s/^\#LogFile\ .*/LogFile \/var\/log\/clamav\/clamd.log/" \
+ -e "s/^\#PidFile.*/PidFile \/var\/run\/clamd.pid/" \
+ -e "s/^\#LocalSocket\ .*/LocalSocket \/var\/run\/clamav\/clamd.socket/" \
+ -e "s/^\#LocalSocketGroup.*/LocalSocketGroup clamav/" \
+ -e "s/^\#LocalSocketMode/LocalSocketMode/" \
+ -e "s/^\#FixStaleSocket/FixStaleSocket/" \
+ -e "s/^\#User.*/User clamav/" \
+ -e "s/^\#AllowSupplementaryGroups.*/AllowSupplementaryGroups yes/" \
+ -e "s/^\#ExitOnOOM/ExitOnOOM/" \
+ -i etc/clamd.conf.sample
+
+chown -R root:root .
chmod -R u+w,go+r-w,a+X-s .
# Compiling the package source:
echo Building ...
+# Thanks to SlackBuilds.org, Matteo Bernardini <ponce@slackbuilds.org>:
+# Check if json-c is there: if it is, build over it to enable
+# the file properties collection and analysis feature
+# http://blog.clamav.net/2014/11/intro-to-collection-and-analysis-of.html
+if pkg-config --exists json-c ; then
+ with_jsonc="--with-libjson"
+else
+ with_jsonc=""
+fi
+
# We need the "clamav" user and group to exist at the time of
# configuring the software...
# Add the 'clamav' group if it doesn't already exist:
@@ -298,22 +352,18 @@ CXXFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--with-user=${CLAMUSR} --with-group=${CLAMGRP} \
--with-dbdir=/usr/share/clamav \
- --disable-milter \
+ $with_jsonc \
--enable-id-check \
+ --enable-clamdtop \
+ --enable-milter \
--disable-check \
--disable-static \
- --build=$ARCH-slackware-linux \
+ --build=$TARGET \
2>&1 | tee $OUTPUT/configure-${PRGNAM}.log
# deprecated:
#--with-libcurl --with-tcpwrappers \
make 2>&1 | tee $OUTPUT/make-${PRGNAM}.log
-cd etc
-patch < $SRCDIR/clamd.conf.patch 2>&1 | tee $OUTPUT/patch-${PRGNAM}.log
-patch < $SRCDIR/freshclam.conf.patch | sed -e "s/db.nl./db.${ISOCC}./" \
- 2>&1 | tee -a $OUTPUT/patch-${PRGNAM}.log
-cd -
-
# Install all the needed stuff to the package dir;
make DESTDIR=$PKG install 2>&1 |tee $OUTPUT/install-${PRGNAM}.log
@@ -321,16 +371,25 @@ make DESTDIR=$PKG install 2>&1 |tee $OUTPUT/install-${PRGNAM}.log
cd $PKG/etc
mv clamd.conf.sample clamd.conf.new
mv freshclam.conf.sample freshclam.conf.new
+mv clamav-milter.conf.sample clamav-milter.conf.new
cd -
-# Where to store the pid file:
+# Where to store the pid, db and log files:
mkdir -p $PKG/var/run/clamav
+mkdir -p $PKG/usr/share/clamav
+mkdir -p $PKG/var/log/clamav
+
+# Ensure that any db files are removed along with the package:
+touch \
+ $PKG/usr/share/clamav/main.cvd \
+ $PKG/usr/share/clamav/bytecode.cvd \
+ $PKG/usr/share/clamav/daily.cvd \
+ $PKG/usr/share/clamav/mirrors.dat
-# Our rc script:
+# Our rc.d and logrotate scripts:
mkdir -p $PKG/etc/rc.d/
-cp $SRCDIR/rc.clamav $PKG/etc/rc.d/rc.clamav.new
-chown root:root $PKG/etc/rc.d/rc.clamav.new
-chmod 754 $PKG/etc/rc.d/rc.clamav.new
+install -D -m 0755 $SRCDIR/rc.clamav $PKG/etc/rc.d/rc.clamav.new
+install -D -m 0644 $SRCDIR/logrotate.clamav $PKG/etc/logrotate.d/clamav.new
# Add a post-install script:
mkdir -p $PKG/install
@@ -351,13 +410,25 @@ config() {
done
}
+preserve_perms() {
+ NEW="\$1"
+ OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
+ if [ -e \$OLD ]; then
+ cp -a \$OLD \${NEW}.incoming
+ cat \$NEW > \${NEW}.incoming
+ mv \${NEW}.incoming \$NEW
+ fi
+ config \$NEW
+}
+
+preserve_perms etc/rc.d/rc.clamav.new
config etc/freshclam.conf.new
config etc/clamd.conf.new
-config etc/rc.d/rc.clamav.new
+config etc/logrotate.d/clamav.new
# Create log files
-touch var/log/clamd.log
-touch var/log/freshclam.log
+touch var/log/clamav/clamd.log
+touch var/log/clamav/freshclam.log
# Only way to create and use the correct uid and gid on the target system,
# is to use chroot:
@@ -374,12 +445,12 @@ chown ${CLAMUSR} usr/sbin/clamav-milter
chmod 4700 usr/sbin/clamav-milter
chown -R ${CLAMUSR}:${CLAMGRP} var/run/clamav
chmod 771 var/run/clamav
-chown ${CLAMUSR}:${CLAMGRP} var/log/clamd.log
-chmod 660 var/log/clamd.log
-chown ${CLAMUSR}:${CLAMGRP} var/log/freshclam.log
-chmod 660 var/log/freshclam.log
+chown -R ${CLAMUSR}:${CLAMGRP} var/log/clamav
+chmod 770 var/log/clamav
+chmod 660 var/log/clamav/*.log
chown -R ${CLAMUSR}:${CLAMGRP} usr/share/clamav
-chmod -R 770 usr/share/clamav
+chmod 770 usr/share/clamav
+chmod 660 usr/share/clamav/*
EOR
EOINS