| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- ##
- ## amavisd.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
- ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## 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.
- ##
- # package versions
- %define V_amavis 2.5.0
- %define V_logsumm 0.6
- # package information
- Name: amavisd
- Summary: Interface Daemon between MTA and Content Checker
- URL: http://www.ijs.si/software/amavisd/
- Vendor: Mark Martinec
- Packager: OpenPKG Foundation e.V.
- Distribution: OpenPKG Community
- Class: BASE
- Group: Mail
- License: GPL
- Version: %{V_amavis}
- Release: 20070423
- # package options
- %option with_milter no
- # list of sources
- Source0: http://www.ijs.si/software/amavisd/amavisd-new-%{version}.tar.gz
- Source1: ftp://ftp.openpkg.org/sources/CPY/VERSIONED/amavisd/amavislogsumm-%{V_logsumm}
- Source2: rc.amavisd
- Patch0: amavisd.patch
- # build information
- Prefix: %{l_prefix}
- BuildRoot: %{l_buildroot}
- BuildPreReq: OpenPKG, openpkg >= 20060823, sed
- PreReq: OpenPKG, openpkg >= 20060823, spamassassin
- PreReq: perl, perl-net, perl-util, perl-mail, perl-time
- PreReq: perl-sys, perl-comp, perl-conv
- %if "%{with_milter}" == "yes"
- BuildPreReq: milter
- PreReq: milter
- %endif
- AutoReq: no
- AutoReqProv: no
- %description
- amavisd-new is a high-performance interface between mailer (MTA) and
- content checkers: virus scanners, and/or SpamAssassin. It is written
- in Perl for maintainability, without paying a significant price
- for speed. It talks to MTA via (E)SMTP or LMTP, or by using helper
- programs. Best with Postfix, works with Exim, sendmail/milter, or
- with any MTA as a SMTP relay.
- %track
- prog amavisd = {
- version = %{version}
- url = http://www.ijs.si/software/amavisd/
- regex = amavisd-new-(\d+\.\d+\.\d+)\.tar\.gz
- }
- prog amavislogsumm = {
- version = %{V_logsumm}
- url = ftp://ftp.openpkg.org/sources/CPY/VERSIONED/amavisd/
- regex = amavislogsumm-(__VER__)
- }
- %prep
- %setup -q -n amavisd-new-%{version}
- cp %{SOURCE amavislogsumm-%{V_logsumm}} amavislogsumm
- %patch -p0
- %build
- # adjust configuration file
- %{l_shtool} subst \
- -e "s;'clamscan';'%{l_prefix}/bin/clamscan';g" \
- -e "s;'uvscan';'%{l_prefix}/bin/uvscan';g" \
- -e "s;'sweep';'%{l_prefix}/bin/sweep';g" \
- -e "s;'f-prot';'%{l_prefix}/bin/f-prot';g" \
- -e 's;/var/run/clamav/clamd;%{l_prefix}/var/clamav/clamd.sock;g' \
- -e 's;/var/amavis;%{l_prefix}/var/amavisd;g' \
- -e 's;/var/virusmails;%{l_prefix}/var/amavisd/virusmails;g' \
- -e 's;/usr/bin/sendmail;%{l_prefix}/sbin/sendmail;g' \
- -e 's; -C/etc/sendmail\.orig\.cf;;g' \
- -e 's;/usr/bin/exim;%{l_prefix}/bin/exim;g' \
- -e 's;/usr/local/sbin;%{l_prefix}/sbin;g' \
- -e 's;/usr/local/bin;%{l_prefix}/bin;g' \
- -e 's;\(daemon_user *= \)[^;]*;\1q{%{l_rusr}};' \
- -e 's;\(daemon_group *= \)[^;]*;\1q{%{l_rgrp}};' \
- -e 's;\(\$DO_SYSLOG *= \)[^;]*;\10;' \
- -e '/^\$MYHOME/s!$!\n$LOGFILE = "$MYHOME/amavisd.log";!' \
- -e 's;\(\$path *=.*\)/usr/local/sbin\(.*\);\1%{l_prefix}/sbin:%{l_prefix}/bin:/usr/local/sbin\2;' \
- amavisd.conf
- # adjust program
- %{l_shtool} subst \
- -e '1s;/usr/bin/perl;%{l_prefix}/bin/perl;' \
- -e 's;/var/amavis;%{l_prefix}/var/amavisd;g' \
- -e 's;/usr/lib/spamassassin;%{l_prefix}/lib/spamassassin;g' \
- amavisd
- # optionally build MILTER
- %if "%{with_milter}" == "yes"
- ( cd helper-progs
- CC="%{l_cc}" \
- CFLAGS="%{l_cflags -O}" \
- LDFLAGS="%{l_ldflags}" \
- ./configure \
- --prefix="%{l_prefix}" \
- --with-sendmail="%{l_prefix}/sbin/sendmail" \
- --with-runtime-dir="%{l_prefix}/var/amavisd" \
- --with-sockname="%{l_prefix}/var/amavisd/amavisd.sock" \
- --with-user="%{l_rusr}" \
- --with-milterinc="%{l_prefix}/include/milter" \
- --with-milterlib="%{l_prefix}/lib"
- %{l_make} %{l_mflags} \
- AMAVIS_USER="%{l_rusr}" \
- AMAVIS_GROUP="%{l_mgrp}"
- ) || exit $?
- %endif
- %install
- # create installation hierarchy
- rm -rf $RPM_BUILD_ROOT
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/sbin \
- $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
- $RPM_BUILD_ROOT%{l_prefix}/etc/amavisd \
- $RPM_BUILD_ROOT%{l_prefix}/share/amavisd \
- $RPM_BUILD_ROOT%{l_prefix}/var/amavisd \
- $RPM_BUILD_ROOT%{l_prefix}/var/amavisd/db \
- $RPM_BUILD_ROOT%{l_prefix}/var/amavisd/tmp \
- $RPM_BUILD_ROOT%{l_prefix}/var/amavisd/var \
- $RPM_BUILD_ROOT%{l_prefix}/var/amavisd/virusmails
- # install programs
- %{l_shtool} install -c -m 755 \
- amavisd $RPM_BUILD_ROOT%{l_prefix}/sbin/
- %{l_shtool} install -c -m 755 \
- -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
- amavislogsumm $RPM_BUILD_ROOT%{l_prefix}/sbin/
- %if "%{with_milter}" == "yes"
- %{l_shtool} install -c -s -m 755 \
- helper-progs/amavis-milter $RPM_BUILD_ROOT%{l_prefix}/sbin/
- %endif
- # install default configuration
- %{l_shtool} install -c -m 644 \
- amavisd.conf $RPM_BUILD_ROOT%{l_prefix}/etc/amavisd/
- # install documentation
- %{l_shtool} install -c -m 644 \
- README_FILES/amavisd-new-docs.html \
- $RPM_BUILD_ROOT%{l_prefix}/share/amavisd/amavisd.html
- # install run-command script
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
- %{SOURCE rc.amavisd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # determine installation files
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
- '%config %{l_prefix}/etc/amavisd/amavisd.conf' \
- '%doc %{l_prefix}/share/amavisd/*' \
- '%attr(0750,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/amavisd' \
- '%attr(0750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/amavisd/*'
- %files -f files
- %clean
- rm -rf $RPM_BUILD_ROOT
- %pre
- # before upgrade, save status and stop service
- [ $1 -eq 2 ] || exit 0
- eval `%{l_rc} amavisd status 2>/dev/null | tee %{l_tmpfile}`
- %{l_rc} amavisd stop 2>/dev/null
- exit 0
- %post
- [ $1 -eq 2 ] || exit 0
- # after upgrade, restore status
- eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
- [ ".$amavisd_active" = .yes ] && %{l_rc} amavisd start
- exit 0
- %preun
- # before erase, stop service and remove log files
- [ $1 -eq 0 ] || exit 0
- %{l_rc} amavisd stop 2>/dev/null
- rm -f $RPM_INSTALL_PREFIX/var/amavisd/.spamassassin >/dev/null 2>&1 || true
- rm -f $RPM_INSTALL_PREFIX/var/amavisd/*.log* >/dev/null 2>&1 || true
- rm -f $RPM_INSTALL_PREFIX/var/amavisd/*.sum* >/dev/null 2>&1 || true
- exit 0
|