2010-04-09 19:19:58 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware Package Build Script for amavisd-new
|
|
|
|
# Home Page http://www.ijs.si/software/amavisd/
|
|
|
|
|
2016-08-19 11:21:07 +02:00
|
|
|
# Copyright (c) 2009-2016, Nishant Limbachia, Hoffman Estates, IL, USA
|
2014-11-25 07:22:53 +01:00
|
|
|
# (nishant _AT_ mnspace _DOT_ net)
|
2010-04-09 19:19:58 +02:00
|
|
|
# All rights reserved.
|
|
|
|
|
2010-04-24 23:07:02 +02:00
|
|
|
# Redistribution and use of this script, with or without modification, is
|
2010-04-09 19:19:58 +02:00
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
|
2010-04-24 23:07:02 +02:00
|
|
|
# 1. Redistributions of script must retain the above copyright notice,
|
2010-04-09 19:19:58 +02:00
|
|
|
# this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
|
|
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
PRGNAM="amavisd-new"
|
2016-08-19 11:21:07 +02:00
|
|
|
VERSION=${VERSION:-2.11.0}
|
2012-06-03 01:50:58 +02:00
|
|
|
ARCH="noarch"
|
2014-11-25 07:22:53 +01:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2012-06-03 01:50:58 +02:00
|
|
|
|
2010-06-04 07:12:17 +02:00
|
|
|
CWD=$(pwd)
|
2010-04-09 19:19:58 +02:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2010-04-24 23:07:02 +02:00
|
|
|
# Create system user and group for amavisd-new
|
2010-04-09 19:19:58 +02:00
|
|
|
if ! grep -q ^amavis: /etc/group ; then
|
|
|
|
echo " Please add a dedicated group to run amavisd-new"
|
2016-08-19 11:21:07 +02:00
|
|
|
echo " # groupadd -g 211 amavis"
|
2010-04-09 19:19:58 +02:00
|
|
|
echo " Or something similar."
|
|
|
|
echo " Add amavis user to clamav group and set AllowSupplementaryGroups yes"
|
|
|
|
echo " in fresclam.conf to allow amavis to scan incoming messages"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! grep -q ^amavis: /etc/passwd ; then
|
|
|
|
echo " Please add a dedicated user to run amavisd-new"
|
2016-08-19 11:21:07 +02:00
|
|
|
echo " # useradd -d /var/lib/amavis -s /bin/bash -u 211 -g 211 amavis"
|
2010-04-09 19:19:58 +02:00
|
|
|
echo " Or something similar."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
USER=${USER:-amavis}
|
|
|
|
GROUP=${GROUP:-amavis}
|
|
|
|
|
|
|
|
AMAVIS_HOME=${AMAVIS_HOME:-/var/lib/amavis}
|
|
|
|
QUARANTINE_DIR=${QUARANTINE_DIR:-$AMAVIS_HOME/quarantine}
|
|
|
|
|
2011-07-10 15:21:20 +02:00
|
|
|
DOCS="AAAREADME.first INSTALL TODO amavisd*.conf* LDAP*
|
|
|
|
RELEASE_NOTES LICENSE README_FILES test-messages"
|
2010-04-09 19:19:58 +02:00
|
|
|
|
2014-11-25 07:22:53 +01:00
|
|
|
rm -fr $TMP/$PRGNAM-$VERSION $PKG
|
2010-04-09 19:19:58 +02:00
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
|
2014-11-25 07:22:53 +01:00
|
|
|
cd $TMP/$PRGNAM-$VERSION
|
2010-04-24 23:07:02 +02:00
|
|
|
chown -R root.root .
|
2013-11-22 08:37:19 +01:00
|
|
|
find -L . \
|
2014-11-25 07:22:53 +01:00
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
|
|
|
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
|
|
|
|
|
|
|
# apply patches
|
|
|
|
for i in $CWD/patches/*.patch; do
|
|
|
|
patch -p0 < $i
|
|
|
|
done
|
2010-04-09 19:19:58 +02:00
|
|
|
|
|
|
|
### amavisd-new home directory
|
|
|
|
mkdir -p $PKG/$AMAVIS_HOME/{tmp,var,db,home}
|
|
|
|
### amavisd-new runtime directory
|
|
|
|
mkdir -p $PKG/var/run/amavis
|
|
|
|
|
|
|
|
### make and populate quarantine directory with subdirectories
|
|
|
|
### this is only useful if you wish to spread out
|
|
|
|
### your quarantine directory into different categories
|
|
|
|
### used by $(clean|banned_files|bad_header|spam|virus)_quarantine_method directive
|
|
|
|
### in amavisd config file
|
2014-11-25 07:22:53 +01:00
|
|
|
mkdir -p $PKG/$QUARANTINE_DIR/{clean,spam,banned,badh,virus,archive}
|
2010-04-09 19:19:58 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/usr/{sbin,doc/$PRGNAM-$VERSION}
|
|
|
|
install -m 0755 -D amavisd $PKG/usr/sbin/$PRGNAM
|
|
|
|
( cd $PKG/usr/sbin; ln -sf $PRGNAM amavisd )
|
2012-06-03 01:50:58 +02:00
|
|
|
|
2014-11-25 07:22:53 +01:00
|
|
|
install -m 0755 amavis-mc amavis-services amavisd-agent \
|
|
|
|
amavisd-nanny amavisd-release amavisd-signer amavisd-snmp-subagent \
|
|
|
|
amavisd-snmp-subagent-zmq amavisd-status amavisd-submit p0f-analyzer.pl \
|
|
|
|
$PKG/usr/sbin
|
2010-04-24 23:07:02 +02:00
|
|
|
install -m 0640 -D amavisd.conf $PKG/etc/amavisd.conf.new
|
2010-04-09 19:19:58 +02:00
|
|
|
|
|
|
|
# change permissions
|
|
|
|
chown $USER:$GROUP $PKG/etc/amavisd.conf.new
|
|
|
|
chown -R $USER:$GROUP $PKG/$AMAVIS_HOME $PKG/var/run/amavis $PKG/$QUARANTINE_DIR
|
|
|
|
chmod -R 0770 $PKG/$AMAVIS_HOME $PKG/var/run/amavis $PKG/$QUARANTINE_DIR
|
|
|
|
|
2014-11-25 07:22:53 +01:00
|
|
|
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
|
2010-04-09 19:19:58 +02:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
### install rc script
|
2011-07-10 15:21:20 +02:00
|
|
|
install -m 0755 -D $CWD/rc.amavisd-new $PKG/etc/rc.d/rc.amavisd-new.new
|
2010-04-09 19:19:58 +02:00
|
|
|
|
|
|
|
### install logrotate script
|
2011-07-10 15:21:20 +02:00
|
|
|
install -D -m 0644 $CWD/amavisd-new.logrotate $PKG/etc/logrotate.d/amavisd-new.new
|
2010-04-09 19:19:58 +02:00
|
|
|
|
|
|
|
### putting slack-desc and doinst.sh in place
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|