summaryrefslogtreecommitdiff
path: root/system/clamav/clamav.SlackBuild
diff options
context:
space:
mode:
authorYalla-One <yallaone@gmail.com>2010-05-13 00:39:54 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-13 00:39:54 +0200
commit8b9fb0d47dbe3761753a21493b737829a96bd146 (patch)
tree231be308f496929a9d0265572199c4e80670da96 /system/clamav/clamav.SlackBuild
parent08a7ad2bc91317a6627d5de166a66fe99a152d66 (diff)
downloadslackbuilds-8b9fb0d47dbe3761753a21493b737829a96bd146.tar.gz
system/clamav: Updated for version 0.95.2
Diffstat (limited to 'system/clamav/clamav.SlackBuild')
-rw-r--r--system/clamav/clamav.SlackBuild137
1 files changed, 71 insertions, 66 deletions
diff --git a/system/clamav/clamav.SlackBuild b/system/clamav/clamav.SlackBuild
index 7810f3846a..2e60518930 100644
--- a/system/clamav/clamav.SlackBuild
+++ b/system/clamav/clamav.SlackBuild
@@ -1,4 +1,5 @@
#!/bin/sh
+
# Copyright (c) 2006,2007 Eric Hameleers <alien@slackware.com>
# All rights reserved.
#
@@ -21,11 +22,11 @@
# -----------------------------------------------------------------------------
# Modified to SBo format with the help of Yalla-One
-# Version bump and various other changes by Robby Workman <rworkman@slackbuilds.org>
+# Version bump and various other changes by Robby Workman
# No additional license terms added
PRGNAM=clamav
-VERSION=0.94
+VERSION=0.95.2
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -39,7 +40,7 @@ OUTPUT=${OUTPUT:-/tmp}
# See http://www.iana.org/cctld/cctld-whois.htm for options
COUNTRY=${COUNTRY:-us}
-# Read "README.slackware" for compatibility with amavisd-new
+# Read "README.SLACKWARE" for compatibility with amavisd-new
CLAMUSR=${CLAMUSR:-clamav}
CLAMGRP=${CLAMGRP:-clamav}
CLAMUID=${CLAMUID:-210}
@@ -47,118 +48,122 @@ CLAMGID=${CLAMGID:-210}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
fi
+bailout() {
+ printf "\n You must have a ${CLAMGRP} group and ${CLAMUSR} user in order
+ to run this script. Add them with something like this:
+ groupadd -g ${CLAMGID} ${CLAMGRP}
+ useradd -u ${CLAMUID} -d /dev/null -s /bin/false -g ${CLAMGRP} ${CLAMUSR}\n"
+ exit 1
+}
+
# Check for ClamAV user and group availability
-DO_EXIT=0
if ! grep ^${CLAMGRP}: /etc/group 2>&1 > /dev/null; then
- cat << EOF
-
- You must have a ${CLAMGRP} group to run this script.
- # groupadd -g ${CLAMGID} ${CLAMGRP}
-
-EOF
- DO_EXIT=1
+ bailout ;
elif ! grep ^${CLAMUSR}: /etc/passwd 2>&1 > /dev/null; then
- cat << EOF
-
- Must have a ${CLAMUSR} user to run this script.
- # useradd -u ${CLAMUID} -d /dev/null -s /bin/false -g ${CLAMGRP} ${CLAMUSR}
-
-EOF
- DO_EXIT=1
+ bailout ;
fi
-[ $DO_EXIT -eq 1 ] && exit
+
+set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
-cd $TMP || exit 1
+cd $TMP
rm -rf $PRGNAM-$VERSION
-tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || exit 1
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION || exit 1
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
-LDFLAGS="$SLKLDFLAGS" \
./configure \
--prefix=/usr \
- --libdir=/usr/lib \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var \
--sysconfdir=/etc \
--mandir=/usr/man \
--with-user=${CLAMUSR} \
--with-group=${CLAMGRP} \
- --with-dbdir=/usr/share/clamav \
- --with-libcurl \
- --with-tcpwrappers \
+ --with-dbdir=/var/lib/clamav \
--enable-milter \
--enable-id-check \
- --disable-static
+ --disable-static \
+ --build=$ARCH-slackware-linux
-make || exit 1
+make
# Patch the configuration files
-cd etc
- patch < $CWD/clamd.conf.patch
- patch < $CWD/freshclam.conf.patch
-cd -
+patch -p1 < $CWD/config/clamd.conf.patch
+patch -p1 < $CWD/config/freshclam.conf.patch
-make install DESTDIR=$PKG || exit 1
+make install DESTDIR=$PKG
# Prepare the config files:
-cd $PKG/etc
- mv clamd.conf clamd.conf.new
- mv freshclam.conf freshclam.conf.new
-cd -
+mv $PKG/etc/clamd.conf $PKG/etc/clamd.conf.new
+mv $PKG/etc/freshclam.conf $PKG/etc/freshclam.conf.new
# 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
-
-# Where to store the pid file:
-mkdir -p $PKG/var/run/clamav
+sed -i "s/@COUNTRY@/${COUNTRY}/g" $PKG/etc/freshclam.conf.new
# Our rc script:
mkdir -p $PKG/etc/rc.d/
-cp $CWD/rc.clamav $PKG/etc/rc.d/rc.clamav.new
+cp $CWD/config/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
+chmod 0755 $PKG/etc/rc.d/rc.clamav.new
-cp $CWD/README README.slackware
-cp -a clamav-milter/INSTALL INSTALL.milter
-DOCS="AUTHORS BUGS COPYING ChangeLog FAQ INSTALL NEWS README UPGRADE \
- docs/*.pdf docs/html examples INSTALL.milter README.slackware"
+# 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/*
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true
-chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/*
+# 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
-# Compress the man page(s)
-find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
+# 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
-# Strip binaries
( cd $PKG
- find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
- find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null
)
-# Ownership, rights:
-chown -R root:root $PKG
-chmod -R o-w $PKG
+# Compress the man page(s)
+find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ AUTHORS BUGS COPYING ChangeLog FAQ INSTALL NEWS README UPGRADE \
+ docs/*.pdf docs/html examples $PKG/usr/doc/$PRGNAM-$VERSION
+chmod 0644 $PKG/usr/doc/$PRGNAM-$VERSION/*
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
-cat $CWD/doinst.sh >> $PKG/install/doinst.sh
-
-# Substitute in the actual user/group parameters used
-sed -i s/_SUB_CLAMUSR/$CLAMUSR/ $PKG/install/doinst.sh
-sed -i s/_SUB_CLAMGRP/$CLAMGRP/ $PKG/install/doinst.sh
-sed -i s/_SUB_CLAMUID/$CLAMUID/ $PKG/install/doinst.sh
-sed -i s/_SUB_CLAMGID/$CLAMGID/ $PKG/install/doinst.sh
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}