File amavisd-new.spec of Package amavisd-new
#
# spec file for package amavisd-new
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: amavisd-new
Summary: High-Performance E-Mail Virus Scanner
Version: 2.6.6
Release: 14
License: GPLv2+
Group: Productivity/Networking/Security
Url: http://www.ijs.si/software/amavisd/
BuildRequires: sendmail sendmail-devel
Requires: gzip bzip2 unarj zoo sharutils file
Requires: perl-Compress-Zlib perl-Convert-UUlib perl-IO-stringy
Requires: perl-MIME-tools perl-MailTools perl-Archive-Tar perl-Unix-Syslog
Requires: perl-Convert-TNEF perl-Archive-Zip perl-Net-Server perl-spamassassin
Requires: perl-BerkeleyDB perl-Mail-DKIM
Requires: smtp_daemon
%if 0%{?suse_version} < 1120
Requires: lha
%endif
Recommends: unrar
Recommends: clamav perl-spamassassin
Recommends: perl-DBI
Recommends: perl-ldap
Recommends: perl-Authen-SASL
Recommends: perl-Mail-ClamAV
Recommends: %{name}-docs = %{version}
PreReq: coreutils net-tools sed pwdutils
PreReq: %insserv_prereq
PreReq: util-linux
Source0: amavisd-new.tar.bz2
Source1: sysconfig.amavis
Source2: rc.amavis
Source5: amavisd-new-rpmlintrc
Patch1: activate_virus_scanner.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define avspool /var/spool/amavis
%define avdb /var/spool/amavis/db
%define avquarantine /var/spool/amavis/virusmails
%define miltersockdir /var/run/amavis
%define logmsg logger -t %{name}/rpm
%define avuser vscan
%define avgroup vscan
%description
Amavisd-new is a high-performance interface between mailer (MTA) and
content checkers: virus scanners or SpamAssassin. It talks to the MTA
via (E)SMTP, LMTP, or by using helper programs. It works with the
following MTAs:
- postfix
- sendmail (sendmail-milter)
- exim
Authors:
--------
Mark Martinec <mark.martinec@ijs.si>
%package docs
Summary: Documentation for the High-Performance E-Mail Virus Scanner
Group: Documentation/Other
License: GPLv2+
Recommends: %{name} = %{version}
%description docs
Amavisd-new is a high-performance interface between mailer (MTA) and
content checkers: virus scanners or SpamAssassin. It talks to the MTA
via (E)SMTP, LMTP, or by using helper programs.
This package contains the documentation and Relase-Notes.
Authors:
--------
Mark Martinec <mark.martinec@ijs.si>
%prep
%setup -q
%patch1
for i in $(ls amavisd*); do
if [[ $i == *patch ]] ; then continue; fi
if [[ $i == *spec ]] ; then continue; fi
sed -i "s|\$daemon_user = 'vscan';|\$daemon_user = '%{avuser}';|g; \
s|\$daemon_group = 'vscan';|\$daemon_group = '%{avgroup}';|g; \
s|^# \$MYHOME =.*|\$MYHOME = '%{avspool}';|g; \
s|/var/amavis/db|%{avdb}|g; \
s|/var/virusmails|%{avquarantine}|g; \
s|/var/amavis/amavisd.sock|%{avspool}/amavisd.sock|g; \
s|/var/run/clamav/clamd|/var/lib/clamav/clamd-socket|g" $i
done
# ---------------------------------------------------------------------------
%build
cd helper-progs
%configure --with-user=%{avuser} \
--with-runtime-dir=%{avspool} \
--with-sockname=%{avspool}/amavisd.sock \
--with-milterlib=%{_libdir}
make %{?jobs:-j%jobs}
# ---------------------------------------------------------------------------
%install
mkdir -p $RPM_BUILD_ROOT/%{avquarantine}
mkdir -p $RPM_BUILD_ROOT/%{avspool}/{tmp,var}
mkdir -p $RPM_BUILD_ROOT/%{avdb}
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
mkdir -p $RPM_BUILD_ROOT/etc/openldap/schema
mkdir -p $RPM_BUILD_ROOT/%{miltersockdir}
mkdir -p $RPM_BUILD_ROOT/%{perl_vendorlib}
install -m 644 $RPM_SOURCE_DIR/sysconfig.amavis $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 755 amavisd $RPM_BUILD_ROOT/%{_sbindir}/amavisd
install -m 755 amavisd-agent $RPM_BUILD_ROOT/%{_sbindir}/amavisd-agent
install -m 755 amavisd-nanny $RPM_BUILD_ROOT/%{_sbindir}/amavisd-nanny
install -m 755 amavisd-release $RPM_BUILD_ROOT/%{_sbindir}/amavisd-release
install -m 755 p0f-analyzer.pl $RPM_BUILD_ROOT/%{_sbindir}/p0f-analyzer.pl
install -m 644 amavisd.conf $RPM_BUILD_ROOT/etc/amavisd.conf
install -m 755 %{S:2} $RPM_BUILD_ROOT/etc/init.d/amavis
ln -s ../../etc/init.d/amavis $RPM_BUILD_ROOT/%{_sbindir}/rcamavis
install -m 755 helper-progs/amavis $RPM_BUILD_ROOT/%{_sbindir}/amavis
install -m 755 helper-progs/amavis-milter $RPM_BUILD_ROOT/%{_sbindir}/amavis-milter
install -m 644 LDAP.schema $RPM_BUILD_ROOT/etc/openldap/schema/amavisd-new.schema
install -m 644 JpegTester.pm $RPM_BUILD_ROOT/%{perl_vendorlib}/JpegTester.pm
%pre
/usr/sbin/groupadd -r %{avgroup} 2> /dev/null || :
%{logmsg} "Added group %{avgroup} for package %{name}"
/usr/sbin/useradd -r -o -g %{avgroup} -u 65 -s /bin/false -c "Vscan account" -d %{avspool} %{avuser} 2> /dev/null || :
/usr/sbin/usermod %{avuser} -g %{avgroup} 2> /dev/null || :
%{logmsg} "Added user %{avuser} for package %{name}"
%preun
%stop_on_removal amavis
%post
%{fillup_and_insserv -n amavis amavis}
# Update ?
if [ ${1:-0} -gt 1 ]; then
: OK currently nothing to do
else
if [ -r etc/aliases ]; then
if ! grep -q "^virusalert:" etc/aliases; then
echo -e "virusalert:\troot" >> etc/aliases
%{logmsg} "Added alias for user virusalert to /etc/aliases"
if [ -x usr/bin/newaliases ]; then
usr/bin/newaliases &>/dev/null || true
else
%{logmsg} "Cannot execute newaliases. Please run it manually."
fi
fi
fi
fi
%postun
%restart_on_update amavis
%{insserv_cleanup}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AAAREADME.first LICENSE INSTALL
%doc LDAP.ldif
%dir /etc/openldap
%dir /etc/openldap/schema
%config /etc/init.d/amavis
%config(noreplace) /etc/amavisd.conf
%config(noreplace) /etc/openldap/schema/amavisd-new.schema
/var/adm/fillup-templates/sysconfig.amavis
%{_sbindir}/*
%{perl_vendorlib}/JpegTester.pm
%defattr(0750,%{avuser},%{avgroup})
%dir %{avspool}
%dir %{avspool}/tmp
%dir %{avspool}/db
%dir %{avspool}/var
%dir %{avquarantine}
%dir %{miltersockdir}
%files docs
%defattr(-,root,root)
%doc RELEASE_NOTES
%doc README_FILES
%doc test-messages
%doc amavisd.conf-*
%doc MANIFEST TODO
%doc test-messages
%changelog