"Fossies" - the Fresh Open Source Software Archive

Member "amavisd-new-2.11.1/amavisd-new.spec" (23 Apr 2008, 6404 Bytes) of package /linux/misc/amavisd-new-2.11.1.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) RPM Spec source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Upstream: <amavis-user$lists,sf,net>
    2 #
    3 #
    4 
    5 %define logmsg logger -t %{name}/rpm
    6 
    7 Summary: Mail virus-scanner
    8 Name: amavisd-new
    9 Version: 2.6.0
   10 Release: 1
   11 License: GPL
   12 Group: System Environment/Daemons
   13 URL: http://www.ijs.si/software/amavisd/
   14 
   15 Packager: Marius Andreiana <marius_andreiana@epon_ro>
   16 Vendor: Amavisd-new
   17 
   18 Source: http://www.ijs.si/software/amavisd/amavisd-new-%{version}.tar.gz
   19 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
   20 
   21 Requires: arc >= 5.21e, nomarch >= 1.2, unrar >= 2.71, zoo >= 2.10
   22 Requires: bzip2, cpio, file, freeze, lha, lzop, ncompress, unarj
   23 Requires: perl(Archive::Tar), perl(Archive::Zip), perl(Compress::Zlib)
   24 Requires: perl(Convert::TNEF), perl(Convert::UUlib), perl(IO::Stringy)
   25 Requires: perl(MIME::Base64), perl(MIME::Tools), perl(Unix::Syslog)
   26 Requires: perl(Time::HiRes), perl(Digest::MD5), perl(Digest::SHA1)
   27 Requires: perl(Digest::HMAC), perl(Net::DNS), perl(Mail::SpamAssassin)
   28 Requires: perl-MailTools, perl(Net::Server) >= 0.86, perl-HTML-Parser >= 3.24
   29 Requires: perl(DB_File), perl(Mail::DKIM) >= 0.31
   30 Obsoletes: amavisd
   31 
   32 %description
   33 AMaViS is a program that interfaces a mail transfer agent (MTA) with
   34 one or more virus scanners.
   35 
   36 Amavisd-new is a branch created by Mark Martinec that adds serveral
   37 performance and robustness features. It's partly based on
   38 work being done on the official amavisd branch. Please see the
   39 README.amavisd-new-RELNOTES file for a detailed description.
   40 
   41 %prep
   42 %setup -n amavisd-new-%{version}
   43 
   44 %{__cat} <<'EOF' >amavisd.sysconfig
   45 EOF
   46 
   47 %{__cat} <<'EOF' >amavisd.sysv
   48 #!/bin/bash
   49 #
   50 # Init script for AMaViS email virus scanner.
   51 #
   52 # Written by Dag Wieers <dag@wieers.com>.
   53 # Modified by Marius Andreiana.
   54 #
   55 # chkconfig: 2345 79 31
   56 # description: AMaViS virus scanner.
   57 #
   58 # processname: amavisd
   59 # config: %{_sysconfdir}/amavisd.conf
   60 # pidfile: %{_localstatedir}/run/amavisd.pid
   61 
   62 source %{_initrddir}/functions
   63 
   64 [ -x %{_sbindir}/amavisd ] || exit 1
   65 [ -r %{_sysconfdir}/amavisd.conf ] || exit 1
   66 
   67 ### Default variables
   68 AMAVIS_ACCOUNT="amavis"
   69 SYSCONFIG="%{_sysconfdir}/sysconfig/amavisd"
   70 prog_config_file=%{_sysconfdir}/amavisd.conf
   71 
   72 ### Read configuration
   73 [ -r "$SYSCONFIG" ] && source "$SYSCONFIG"
   74 
   75 RETVAL=0
   76 prog="amavisd"
   77 desc="Mail Virus Scanner"
   78 
   79 start() {
   80     echo -n $"Starting $desc ($prog): "
   81     daemon --user "$AMAVIS_ACCOUNT" %{_sbindir}/$prog -c $prog_config_file
   82     RETVAL=$?
   83     echo
   84     [ $RETVAL -eq 0 ] && touch %{_localstatedir}/lock/subsys/$prog
   85     return $RETVAL
   86 }
   87 
   88 stop() {
   89     echo -n $"Shutting down $desc ($prog): "
   90     su - $AMAVIS_ACCOUNT -c "%{_sbindir}/$prog -c $prog_config_file stop"
   91     RETVAL=$?
   92     echo
   93     [ $RETVAL -eq 0 ] && rm -f %{_localstatedir}/lock/subsys/$prog
   94     return $RETVAL
   95 }
   96 
   97 reload() {
   98     echo -n $"Reloading $desc ($prog): "
   99     su - $AMAVIS_ACCOUNT -c "%{_sbindir}/$prog -c $prog_config_file reload"
  100     RETVAL=$?
  101     echo
  102     return $RETVAL
  103 }
  104 
  105 restart() {
  106     stop
  107     start
  108 }
  109 
  110 case "$1" in
  111   start)
  112     start
  113     ;;
  114   stop)
  115     stop
  116     ;;
  117   restart)
  118     restart
  119     ;;
  120   reload)
  121     reload
  122     ;;
  123   condrestart)
  124     [ -e %{_localstatedir}/lock/subsys/$prog ] && restart
  125     RETVAL=$?
  126     ;;
  127   status)
  128     status $prog
  129     RETVAL=$?
  130     ;;
  131   *)
  132     echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
  133     RETVAL=1
  134 esac
  135 
  136 exit $RETVAL
  137 EOF
  138 
  139 %build
  140 
  141 %install
  142 %{__rm} -rf %{buildroot}
  143 %{__install} -d -m0755 %{buildroot}%{_sbindir}
  144 
  145 %{__perl} -pi.orig -e '
  146         s|=\s*'\''vscan'\''|= "amavis"|;
  147         s|^#*(\$MYHOME)\s*=.*$|$1 = "%{_localstatedir}/spool/amavis";|;
  148         s|^#*(\$QUARANTINEDIR)\s*=.*$|$1 = "\$MYHOME/virusmails";|
  149     ' amavisd.conf
  150 
  151 %{__install} -d -m0700 %{buildroot}%{_localstatedir}/spool/amavis/virusmails/
  152 %{__install} -d -m0700 %{buildroot}%{_localstatedir}/amavis/tmp
  153 %{__install} -d -m0700 %{buildroot}%{_localstatedir}/amavis/db
  154 
  155 %{__install} -D -m0755 amavisd %{buildroot}%{_sbindir}/amavisd
  156 %{__install} -D -m0755 amavisd-nanny %{buildroot}%{_sbindir}/amavisd-nanny
  157 %{__install} -D -m0755 amavisd-agent %{buildroot}%{_sbindir}/amavisd-agent
  158 %{__install} -D -m0755 p0f-analyzer.pl %{buildroot}%{_sbindir}/p0f-analyzer.pl
  159 %{__install} -D -m0755 amavisd.sysv %{buildroot}%{_initrddir}/amavisd
  160 %{__install} -D -m0700 amavisd.conf %{buildroot}%{_sysconfdir}/amavisd.conf
  161 %{__install} -D -m0644 LDAP.schema %{buildroot}%{_sysconfdir}/openldap/schema/amavisd-new.schema
  162 %{__install} -D -m0644 amavisd.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/amavisd
  163 
  164 %clean
  165 %{__rm} -rf %{buildroot}
  166 
  167 %pre
  168 /usr/sbin/useradd -c "AMaViS email scanner user" -M -s /bin/sh -r amavis \
  169         -d "/var/spool/amavis" &>/dev/null || :
  170 
  171 %post
  172 /sbin/chkconfig --add amavisd
  173 
  174 if [ -r /etc/postfixes/aliases ]; then
  175     if ! grep -q "^virusalert:" /etc/postfix/aliases; then
  176         echo -e "virusalert:\troot" >> /etc/postfix/aliases
  177         if [ -x /usr/bin/newaliases ]; then
  178             /usr/bin/newaliases &>/dev/null
  179         else
  180             %logmsg "Cannot exec newaliases. Please run it manually."
  181         fi
  182     fi
  183 fi
  184 
  185 if [ -r /etc/mail/aliases ]; then
  186     if ! grep -q "^virusalert:" /etc/mail/aliases; then
  187         echo -e "virusalert:\troot" >> /etc/mail/aliases
  188         if [ -x /usr/bin/newaliases ]; then
  189             /usr/bin/newaliases &>/dev/null
  190         else
  191             %logmsg "Cannot exec newaliases. Please run it manually."
  192         fi
  193     fi
  194 fi
  195 
  196 %preun
  197 if [ $1 -eq 0 ] ; then
  198     /sbin/service amavisd stop &>/dev/null || :
  199     /sbin/chkconfig --del amavisd
  200 fi
  201 
  202 %postun
  203 if [ $1 -ne 0 ]; then
  204     /sbin/service amavisd condrestart &>/dev/null || :
  205 fi
  206 
  207 if [ "`getent passwd amavis`" ]; then
  208     echo -en "removing user amavis.\n"
  209     /usr/sbin/userdel "amavis" 2>/dev/null || :
  210 fi
  211 if [ "`getent group amavis`" ]; then
  212     echo -en "removing group amavis.\n"
  213     /usr/sbin/groupdel "amavis" 2>/dev/null || :
  214 fi
  215 
  216 %files
  217 %defattr(-, root, root, 0755)
  218 %doc AAAREADME.first LDAP.schema LICENSE MANIFEST RELEASE_NOTES README_FILES/* test-messages/
  219 %config %{_initrddir}/amavisd
  220 %config %{_sysconfdir}/openldap/schema/*.schema
  221 #%{_sbindir}/amavis
  222 %{_sbindir}/amavisd
  223 
  224 %defattr(0640, root, amavis, 0755)
  225 %config(noreplace) %{_sysconfdir}/amavisd.conf
  226 %config(noreplace) %{_sysconfdir}/sysconfig/amavisd
  227 
  228 %defattr(0700, amavis, amavis, 0700)
  229 %dir %{_localstatedir}/spool/amavis/
  230 %dir %{_localstatedir}/spool/amavis/virusmails/
  231 %dir %{_localstatedir}/amavis
  232 %dir %{_localstatedir}/amavis/tmp
  233 %dir %{_localstatedir}/amavis/db
  234 
  235 
  236 %changelog
  237 * Mon Oct 06 2004  Marius Andreiana
  238 - Use amavisd's stop, reload, as Mark suggested
  239 - remove amavis user/group on uninstall
  240 - fix perms on /var/amavis
  241 
  242 * Mon Oct 04 2004  Marius Andreiana
  243 - Initial release, changed DAG's spec file
  244