diff --git a/system/clamav/clamav.SlackBuild b/system/clamav/clamav.SlackBuild index 2376ce656d..5e3fc771e5 100644 --- a/system/clamav/clamav.SlackBuild +++ b/system/clamav/clamav.SlackBuild @@ -23,19 +23,18 @@ # Modified to SBo format with the help of Yalla-One # Version bump and various other changes by Robby Workman +# New version bump and various other changes by ponce # No additional license terms added PRGNAM=clamav -VERSION=0.95.2 +VERSION=${VERSION:-0.97.2} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} -# Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i486 ;; arm*) ARCH=arm ;; - # Unless $ARCH is already set, use uname -m for all other archs: *) ARCH=$( uname -m ) ;; esac fi @@ -95,6 +94,35 @@ cd $PRGNAM-$VERSION || exit 1 chown -R root:root . chmod -R u+w,go+r-w,a-s . +# Specify the desired mirror in the update config file +# http://www.iana.org/cctld/cctld-whois.htm +sed -i "s/^\#DatabaseMirror.*/DatabaseMirror db.${COUNTRY}.clamav.net/" etc/freshclam.conf + +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 ${CLAMUSR}/" \ + -e "s/^\#NotifyClamd.*/NotifyClamd \/etc\/clamd.conf/" \ + -i etc/freshclam.conf +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\/clamav\/clamd.pid/" \ + -e "s/^\#LocalSocket\ .*/LocalSocket \/var\/run\/clamav\/clamd.socket/" \ + -e "s/^\#LocalSocketGroup.*/LocalSocketGroup ${CLAMGRP}/" \ + -e "s/^\#LocalSocketMode/LocalSocketMode/" \ + -e "s/^\#FixStaleSocket/FixStaleSocket/" \ + -e "s/^\#User.*/User ${CLAMUSR}/" \ + -e "s/^\#AllowSupplementaryGroups.*/AllowSupplementaryGroups yes/" \ + -e "s/^\#ExitOnOOM/ExitOnOOM/" \ + -i etc/clamd.conf + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ @@ -109,51 +137,38 @@ CXXFLAGS="$SLKCFLAGS" \ --enable-milter \ --enable-id-check \ --disable-static \ + --disable-experimental \ --build=$ARCH-slackware-linux -make - -# Patch the configuration files -patch -p1 < $CWD/config/clamd.conf.patch -patch -p1 < $CWD/config/freshclam.conf.patch - +make V=1 make install DESTDIR=$PKG # Prepare the config files: -mv $PKG/etc/clamd.conf $PKG/etc/clamd.conf.new -mv $PKG/etc/freshclam.conf $PKG/etc/freshclam.conf.new +for cf in clamd freshclam clamav-milter; do + mv $PKG/etc/$cf.conf $PKG/etc/$cf.conf.new +done -# Specify the desired mirror in the update config file -# http://www.iana.org/cctld/cctld-whois.htm -sed -i "s/@COUNTRY@/${COUNTRY}/g" $PKG/etc/freshclam.conf.new - -# Our rc script: -mkdir -p $PKG/etc/rc.d/ -cp $CWD/config/rc.clamav $PKG/etc/rc.d/rc.clamav.new -chown root:root $PKG/etc/rc.d/rc.clamav.new -chmod 0755 $PKG/etc/rc.d/rc.clamav.new +# Our rc script and logrotate entry: +install -D -m 0755 $CWD/rc.clamav $PKG/etc/rc.d/rc.clamav.new +install -D -m 0644 $CWD/logrotate.clamav $PKG/etc/logrotate.d/clamav # Fixup some ownership and permissions issues chown -R root:root $PKG chmod -R o-w $PKG chown ${CLAMUSR} $PKG/usr/sbin/clamav-milter chmod 4700 $PKG/usr/sbin/clamav-milter -chown -R ${CLAMUSR}:${CLAMGRP} $PKG/var/lib/clamav chmod 0770 $PKG/var/lib/clamav chmod 0660 $PKG/var/lib/clamav/* -# Create pid and socket directory -mkdir -p $PKG/var/run/clamav -chown -R ${CLAMUSR}:${CLAMGRP} $PKG/var/run/clamav -chmod 771 $PKG/var/run/clamav +# Create pid, socket and log directories +mkdir -p $PKG/var/{log,run}/clamav +chmod 771 $PKG/var/{log,run}/clamav # Create log files in such a way that they won't clobber existing ones -mkdir -p $PKG/var/log -touch $PKG/var/log/{clamd,freshclam}.log.new -chown ${CLAMUSR}:${CLAMGRP} $PKG/var/log/clamd.log.new -chmod 660 $PKG/var/log/clamd.log.new -chown ${CLAMUSR}:${CLAMGRP} $PKG/var/log/freshclam.log.new -chmod 660 $PKG/var/log/freshclam.log.new +touch $PKG/var/log/clamav/{clamd,freshclam}.log.new +chmod 660 $PKG/var/log/clamav/{clamd,freshclam}.log.new + +chown -R ${CLAMUSR}:${CLAMGRP} $PKG/var/{lib,log,run}/clamav find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true diff --git a/system/clamav/clamav.info b/system/clamav/clamav.info index da3ba08f27..56ae5fa7a5 100644 --- a/system/clamav/clamav.info +++ b/system/clamav/clamav.info @@ -1,10 +1,10 @@ PRGNAM="clamav" -VERSION="0.95.2" +VERSION="0.97.2" HOMEPAGE="http://www.clamav.net/" -DOWNLOAD="http://downloads.sourceforge.net/clamav/clamav-0.95.2.tar.gz" -MD5SUM="930362397d30e01ba81b5f24c1046d48" +DOWNLOAD="http://downloads.sourceforge.net/clamav/clamav-0.97.2.tar.gz" +MD5SUM="cb2d78b4790fdfca3b2390d7ce82f0b7" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -MAINTAINER="Yalla-One" -EMAIL="yallaone@gmail.com" -APPROVED="rworkman" +MAINTAINER="ponce" +EMAIL="matteo.bernardini@gmail.com" +APPROVED="Niels Horn" diff --git a/system/clamav/config/clamd.conf.patch b/system/clamav/config/clamd.conf.patch deleted file mode 100644 index a18ff49d88..0000000000 --- a/system/clamav/config/clamd.conf.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff -Nur clamav-0.95.2.orig/etc/clamd.conf clamav-0.95.2/etc/clamd.conf ---- clamav-0.95.2.orig/etc/clamd.conf 2009-04-07 05:32:06.000000000 -0500 -+++ clamav-0.95.2/etc/clamd.conf 2009-08-10 10:56:05.791514384 -0500 -@@ -5,7 +5,7 @@ - - - # Comment or remove the line below. --Example -+#Example - - # Uncomment this option to enable logging. - # LogFile must be writable for the user running daemon. -@@ -40,12 +40,12 @@ - - # Use system logger (can work together with LogFile). - # Default: no --#LogSyslog yes -+LogSyslog yes - - # Specify the type of syslog messages - please refer to 'man syslog' - # for facility names. - # Default: LOG_LOCAL6 --#LogFacility LOG_MAIL -+LogFacility LOG_MAIL - - # Enable verbose logging. - # Default: no -@@ -54,7 +54,7 @@ - # This option allows you to save a process identifier of the listening - # daemon (main thread). - # Default: disabled --#PidFile /var/run/clamd.pid -+PidFile /var/run/clamav/clamd.pid - - # Optional path to the global temporary directory. - # Default: system specific (usually /tmp or /var/tmp). -@@ -69,11 +69,11 @@ - - # Path to a local socket file the daemon will listen on. - # Default: disabled (must be specified by a user) --LocalSocket /tmp/clamd.socket -+LocalSocket /var/run/clamav/clamd.socket - - # Remove stale socket after unclean shutdown. - # Default: yes --#FixStaleSocket yes -+FixStaleSocket yes - - # TCP port address. - # Default: no -@@ -167,14 +167,14 @@ - - # Run as another user (clamd must be started by root for this option to work) - # Default: don't drop privileges --#User clamav -+User clamav - - # Initialize supplementary group access (clamd must be started by root). - # Default: no --#AllowSupplementaryGroups no -+AllowSupplementaryGroups yes - - # Stop daemon when libclamav reports out of memory condition. --#ExitOnOOM yes -+ExitOnOOM yes - - # Don't fork into background. - # Default: no diff --git a/system/clamav/config/freshclam.conf.patch b/system/clamav/config/freshclam.conf.patch deleted file mode 100644 index a55c90cd9a..0000000000 --- a/system/clamav/config/freshclam.conf.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff -Nur clamav-0.95.2.orig/etc/freshclam.conf clamav-0.95.2/etc/freshclam.conf ---- clamav-0.95.2.orig/etc/freshclam.conf 2009-03-16 13:43:35.000000000 -0500 -+++ clamav-0.95.2/etc/freshclam.conf 2009-08-10 10:53:12.146515711 -0500 -@@ -5,7 +5,7 @@ - - - # Comment or remove the line below. --Example -+#Example - - # Path to the database directory. - # WARNING: It must match clamd.conf's directive! -@@ -34,25 +34,25 @@ - - # Use system logger (can work together with UpdateLogFile). - # Default: no --#LogSyslog yes -+LogSyslog yes - - # Specify the type of syslog messages - please refer to 'man syslog' - # for facility names. - # Default: LOG_LOCAL6 --#LogFacility LOG_MAIL -+LogFacility LOG_MAIL - - # This option allows you to save the process identifier of the daemon - # Default: disabled --#PidFile /var/run/freshclam.pid -+PidFile /var/run/clamav/freshclam.pid - - # By default when started freshclam drops privileges and switches to the - # "clamav" user. This directive allows you to change the database owner. - # Default: clamav (may depend on installation options) --#DatabaseOwner clamav -+DatabaseOwner clamav - - # Initialize supplementary group access (freshclam must be started by root). - # Default: no --#AllowSupplementaryGroups yes -+AllowSupplementaryGroups yes - - # Use DNS to verify virus database version. Freshclam uses DNS TXT records - # to verify database and software versions. With this directive you can change -@@ -64,7 +64,7 @@ - - # Uncomment the following line and replace XY with your country - # code. See http://www.iana.org/cctld/cctld-whois.htm for the full list. --#DatabaseMirror db.XY.clamav.net -+#DatabaseMirror db.@COUNTRY@.clamav.net - - # database.clamav.net is a round-robin record which points to our most - # reliable mirrors. It's used as a fall back in case db.XY.clamav.net is -@@ -111,7 +111,7 @@ - - # Send the RELOAD command to clamd. - # Default: no --#NotifyClamd /path/to/clamd.conf -+NotifyClamd /etc/clamd.conf - - # Run command after successful database update. - # Default: disabled diff --git a/system/clamav/doinst.sh b/system/clamav/doinst.sh index 16dadeafc3..13c919b36b 100644 --- a/system/clamav/doinst.sh +++ b/system/clamav/doinst.sh @@ -13,9 +13,22 @@ 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 var/log/clamd.log.new ; rm -f var/log/clamd.log.new -config var/log/freshclam.log.new ; rm -f var/log/freshclam.log.new +config etc/clamav-milter.conf.new +# Remove new log if one is already present +config var/log/clamav/clamd.log.new ; rm -f var/log/clamav/clamd.log.new +config var/log/clamav/freshclam.log.new ; rm -f var/log/clamav/freshclam.log.new diff --git a/system/clamav/logrotate.clamav b/system/clamav/logrotate.clamav new file mode 100644 index 0000000000..8154a8ba4e --- /dev/null +++ b/system/clamav/logrotate.clamav @@ -0,0 +1,11 @@ +/var/log/clamav/*.log { + weekly + rotate 5 + compress + delaycompress + notifempty + missingok + postrotate + /bin/kill -HUP `cat /var/run/clamav/clamd.pid 2>/dev/null` 2>/dev/null || true + endscript +} diff --git a/system/clamav/config/rc.clamav b/system/clamav/rc.clamav similarity index 100% rename from system/clamav/config/rc.clamav rename to system/clamav/rc.clamav