summaryrefslogtreecommitdiffstats
path: root/clamav
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2005-05-21 12:13:48 +0000
committer Eric Hameleers <alien@slackware.com>2005-05-21 12:13:48 +0000
commit9d47c00278b8c03df1599271b2cce5cec879749f (patch)
tree56642786c6fa7074d01201eee0526bd910201a5c /clamav
parent26f3e8ac999e1f82657a85d4a8910005f8350455 (diff)
downloadasb-9d47c00278b8c03df1599271b2cce5cec879749f.tar.gz
asb-9d47c00278b8c03df1599271b2cce5cec879749f.tar.xz
Initial revision
Diffstat (limited to 'clamav')
-rwxr-xr-xclamav/build/clamav.SlackBuild267
1 files changed, 267 insertions, 0 deletions
diff --git a/clamav/build/clamav.SlackBuild b/clamav/build/clamav.SlackBuild
new file mode 100755
index 00000000..0c59a006
--- /dev/null
+++ b/clamav/build/clamav.SlackBuild
@@ -0,0 +1,267 @@
+#!/bin/sh
+#
+# -----------------------------------------------------------------------------
+# $Id$
+# Slackware SlackBuild script
+# ===========================
+# By: Eric Hameleers
+# For: clamav
+# URL: http://clamav.net/
+# Needs:
+# Changelog:
+# 0.80-1: 30/nov/2004 by Eric Hameleers
+# * Initial build.
+# 0.80-2: 02/dec/2004 by Eric Hameleers
+# * Fix permissions on "/var/run/clamav" directory
+# 0.81-1: 02/feb/2005 by Eric Hameleers
+# * Rebuilt for new version
+# 0.83-1: 15/feb/2005 by Eric Hameleers
+# * Rebuilt for new version
+# 0.83-2: 15/feb/2005 by Eric Hameleers
+# * Patch freshclam.conf and clamav.conf for better package
+# defaults. Make rc.clamav executable. Add option to rc.clamav
+# to disable milter support.
+# 0.84-1: 30/apr/2005 by Eric Hameleers
+# * Rebuilt for new version
+# 0.85-1: 14/may/2005 by Eric Hameleers
+# * Add '--enable-id-check' to configure command.
+# 0.85.1-1: 21/may/2005 by Eric Hameleers
+# * Rebuilt for the new release.
+#
+# Run 'sh SlackBuild --cleanup' to build a Slackware package.
+# The package (.tgz) plus descriptive .txt file are created in /tmp .
+# Install using 'installpkg'.
+#
+# -----------------------------------------------------------------------------
+
+# --- INIT ---
+# Set initial variables:
+CWD=`pwd`
+if [ "$TMP" = "" ]; then
+ TMP=/tmp
+fi
+
+PRGNAM=clamav
+VERSION=0.85
+ARCH=${ARCH:-i486}
+BUILD=1
+
+# Read "README.slackware" for compatibility with amavisd-new
+CLAMUSR=clamav
+CLAMGRP=clamav
+
+if [ "$ARCH" = "i386" ]; then
+ SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
+elif [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2"
+fi
+
+PKG=$TMP/package-$PRGNAM
+
+if [ ! -d $TMP/tmp-$PRGNAM ]; then
+ mkdir -p $TMP/tmp-$PRGNAM # location to build the source
+fi
+if [ ! -d $PKG ]; then
+ mkdir -p $PKG # place for the package to be built
+fi
+
+
+# --- PACKAGE BUILDING ---
+
+echo "++"
+echo "|| $PRGNAM-$VERSION"
+echo "++"
+
+rm -rf $PKG/*
+
+cd $PKG
+
+# Explode the package framework:
+if [ -f $CWD/_$PRGNAM.tar.gz ]; then
+ explodepkg $CWD/_$PRGNAM.tar.gz
+fi
+
+cd $TMP/tmp-$PRGNAM
+
+
+# --- TARBALL EXTRACTION,PATCH,MODIFY ---
+
+echo "Extracting the program tarball for $PRGNAM..."
+tar -xzvf $CWD/${PRGNAM}-${VERSION}.tar.gz
+
+cd ${PRGNAM}-${VERSION}
+
+chown -R root.root *
+
+
+# --- BUILDING ---
+
+echo Building ...
+
+# 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:
+/usr/sbin/groupadd ${CLAMGRP} 2> /dev/null
+# Add the 'clamav' user if it doesn't exist already:
+/usr/sbin/useradd -c "ClamAV user" -g ${CLAMGRP} \
+ -s "/bin/false" ${CLAMUSR} 2> /dev/null
+
+CFLAGS="$SLKCFLAGS" \
+./configure --prefix=/usr \
+ --localstatedir=/var \
+ --sysconfdir=/etc \
+ --with-user=${CLAMUSR} --with-group=${CLAMGRP} \
+ --with-dbdir=/usr/share/clamav \
+ --with-libcurl \
+ --with-tcpwrappers \
+ --enable-milter \
+ --enable-id-check \
+ 2>&1 | tee $CWD/configure-${PRGNAM}.log
+make 2>&1 | tee $CWD/make-${PRGNAM}.log
+
+(cd etc
+ patch < $CWD/clamav.conf.patch
+ patch < $CWD/freshclam.conf.patch
+)
+
+#
+# Install all the needed stuff to the package dir
+#
+# Use installwatch if available:
+which installwatch > /dev/null 2>&1
+if [ $? == 0 ]; then
+ installwatch -o $CWD/install-${PRGNAM}.log make DESTDIR=$PKG install
+else
+ make DESTDIR=$PKG install 2>&1 |tee $CWD/install-${PRGNAM}.log
+fi
+
+# Prepare the config files:
+(cd $PKG/etc
+ mv clamd.conf clamd.conf.new
+ mv freshclam.conf freshclam.conf.new
+)
+
+# Where to store the pid file:
+mkdir -p $PKG/var/run/clamav
+
+# Our rc script:
+mkdir -p $PKG/etc/rc.d/
+cp -a $CWD/rc.clamav $PKG/etc/rc.d/rc.clamav.new
+chmod 754 $PKG/etc/rc.d/rc.clamav.new
+
+# --- POST-INSTALL SCRIPT ---
+#
+#
+# --- Fabricate the 'doinst.sh' script: ------
+
+mkdir -p $PKG/install
+
+cat <<EOINS > $PKG/install/doinst.sh
+# Handle the incoming configuration files:
+config() {
+ for infile in \$1; do
+ NEW="\$infile"
+ OLD="\`dirname \$NEW\`/\`basename \$NEW .new\`"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r \$OLD ]; then
+ mv \$NEW \$OLD
+ elif [ "\`cat \$OLD | md5sum\`" = "\`cat \$NEW | md5sum\`" ]; then
+ # toss the redundant copy
+ rm \$NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+ done
+}
+
+config etc/clamd.conf.new
+config etc/clamd.conf.new
+config etc/rc.d/rc.clamav.new
+
+# Add the '${CLAMGRP}' group if it doesn't already exist:
+# Actually, the use of "amavis" group is for compatibility with amavisd-new.
+/usr/sbin/groupadd ${CLAMGRP} 2> /dev/null
+# Add the '${CLAMUSR}' user if it doesn't already exist:
+/usr/sbin/useradd -c "ClamAV user" \\
+ -g ${CLAMGRP} -s "/bin/false" ${CLAMUSR} 2> /dev/null
+
+# Create log files
+touch var/log/clamd.log
+touch var/log/freshclam.log
+
+# Restore the correct permissions
+/usr/bin/chown ${CLAMUSR} usr/sbin/clamav-milter
+/usr/bin/chmod 4700 usr/sbin/clamav-milter
+/usr/bin/chown -R ${CLAMUSR}:${CLAMGRP} var/run/clamav
+/usr/bin/chmod -R 770 var/run/clamav
+/usr/bin/chown ${CLAMUSR}:${CLAMGRP} var/log/clamd.log
+/usr/bin/chmod 660 var/log/clamd.log
+/usr/bin/chown ${CLAMUSR}:${CLAMGRP} var/log/freshclam.log
+/usr/bin/chmod 660 var/log/freshclam.log
+/usr/bin/chown -R ${CLAMUSR}:${CLAMGRP} usr/share/clamav
+/usr/bin/chmod -R 770 usr/share/clamav
+
+EOINS
+
+# --- End of 'doinst.sh' script -----------
+
+
+# --- DOCUMENTATION ---
+
+cp -a clamav-milter/INSTALL INSTALL.milter
+DOCS="AUTHORS BUGS COPYING ChangeLog FAQ INSTALL NEWS README TODO \
+ contrib docs/*.pdf docs/MacOSX docs/html examples \
+ INSTALL.milter \
+ $CWD/README.slackware"
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a $DOCS \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/*
+
+# Compress the man page(s)
+gzip -9f $PKG/usr/man/*/*
+
+# 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
+)
+
+
+# --- OWNERSHIP, RIGHTS ---
+
+chmod -R o-w $PKG
+chgrp root:bin $PKG/usr/bin/* $PKG/usr/sbin/* \
+ $PKG/bin/* $PKG/sbin/* 2>/dev/null
+
+
+# --- PACKAGE DESCRIPTION ---
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+if [ -f $CWD/doinst.sh ]; then
+ cat $CWD/doinst.sh > $PKG/install/doinst.sh
+fi
+
+
+# --- BUILDING ---
+
+# Build the package:
+cd $PKG
+makepkg --linkadd y --chown n $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.tgz \
+ 2>&1 | tee $CWD/makepkg-${PRGNAM}.log
+(cd $TMP && md5sum $PRGNAM-$VERSION-$ARCH-$BUILD.tgz > $PRGNAM-$VERSION-$ARCH-$BUILD.tgz.md5)
+cat $CWD/slack-desc | grep "^${PRGNAM}" > $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.txt
+
+
+# --- CLEANUP ---
+
+# Clean up the extra stuff:
+if [ "$1" = "--cleanup" ]; then
+ rm -rf $TMP/tmp-$PRGNAM
+ rm -rf $PKG
+fi