8e57baa7b19c94022620b2f2157a3903ded4b247
[packages/amavisd-new.git] / amavisd-new.spec
1 # TODO:
2 # - Add polish info mail templates
3 # - move amavis part of tmpwatch configuration from tmpwatch.spec
4 #
5 %include        /usr/lib/rpm/macros.perl
6 Summary:        A Mail Virus Scanner with SpamAssassin support - daemon
7 Summary(pl.UTF-8):      Antywirusowy skaner poczty elektronicznej z obsługą SpamAssasina - demon
8 Name:           amavisd-new
9 Version:        2.11.0
10 Release:        1
11 Epoch:          1
12 License:        GPL
13 Group:          Applications/Mail
14 Source0:        http://www.ijs.si/software/amavisd/%{name}-%{version}.tar.xz
15 # Source0-md5:  4642d63c5d3f0daafbcacb9bb553e6f3
16 Source1:        %{name}.init
17 Source3:        %{name}.tmpwatch
18 Patch0:         %{name}-config.patch
19 Patch1:         %{name}-tools-dbdir.patch
20 URL:            http://www.ijs.si/software/amavisd/
21 BuildRequires:  rpm-perlprov
22 BuildRequires:  rpmbuild(macros) >= 1.671
23 BuildRequires:  tar >= 1:1.22
24 Requires(post,preun):   /sbin/chkconfig
25 Requires(postun):       /usr/sbin/groupdel
26 Requires(postun):       /usr/sbin/userdel
27 Requires(pre):  /bin/id
28 Requires(pre):  /usr/bin/getgid
29 Requires(pre):  /usr/sbin/groupadd
30 Requires(pre):  /usr/sbin/useradd
31 Requires:       /usr/lib/sendmail
32 Requires:       perl-Archive-Tar
33 Requires:       perl-Archive-Zip >= 1.14
34 Requires:       perl-Convert-BinHex
35 Requires:       perl-Convert-TNEF
36 Requires:       perl-Convert-UUlib >= 1.05
37 Requires:       perl-File-LibMagic
38 Requires:       perl-IO-Compress
39 Requires:       perl-MIME-tools
40 Requires:       perl-Net-LibIDN
41 Requires:       perl-Net-Server >= 0.93
42 Requires:       perl-Time-HiRes >= 1.49
43 Requires:       perl-Unix-Syslog
44 Requires:       perl-libnet
45 Requires:       rc-scripts >= 0.4.1.23
46 Requires:       sh-utils
47 Suggests:       amavisd-milter >= 1.5.0
48 #Suggests:      arc
49 #Suggests:      arj
50 Suggests:       binutils
51 Suggests:       bzip2
52 Suggests:       cabextract
53 Suggests:       clamav
54 Suggests:       cpio
55 Suggests:       dspam
56 Suggests:       freeze
57 Suggests:       gzip
58 Suggests:       lha
59 Suggests:       lzop
60 #Suggests:      melt
61 Suggests:       ncompress
62 Suggests:       nomarch
63 Suggests:       pax
64 Suggests:       perl-Authen-SASL
65 Suggests:       unarj
66 #Suggests:      unfreeze
67 # required already by perl-Mail-SpamAssassin
68 #Suggests:      perl-DB_File
69 #Suggests:      perl-IO-Socket-INET6
70 # required when doing SQL lookups
71 Suggests:       p0f
72 #Suggests:      perl-DBD-mysql
73 Suggests:       perl-Digest-MD5
74 Suggests:       perl-Mail-DKIM >= 0.31
75 Suggests:       perl-Mail-SpamAssassin > 3.3.0
76 Suggests:       perl-Razor
77 Suggests:       perl-SAVI
78 Suggests:       perl-ldap
79 #Suggests:      rar
80 #Suggests:      ripole
81 Suggests:       rpm-utils
82 Suggests:       tnef
83 Suggests:       unrar
84 Suggests:       unzoo
85 #Suggests:      zoo
86 Provides:       group(amavis)
87 Provides:       user(amavis)
88 Obsoletes:      AMaViS
89 Obsoletes:      amavis
90 Obsoletes:      amavisd
91 Obsoletes:      amavisd-daemon
92 Obsoletes:      amavisd-exim
93 Obsoletes:      amavisd-new-exim
94 Obsoletes:      amavisd-new-postfix
95 Obsoletes:      amavisd-new-qmail
96 Obsoletes:      amavisd-postfix
97 Obsoletes:      amavisd-qmail
98 Conflicts:      amavis-stats <= 0.1.12
99 Conflicts:      postfix < 2.7.0
100 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
101
102 %define         _tmpwatchdir    /etc/tmpwatch
103 %define         schemadir       /usr/share/openldap/schema
104
105 %description
106 AMaViS is a script that interfaces a mail transport agent (MTA) with
107 one or more virus scanners and SpamAssasin. This is daemonized version
108 of amavis.
109
110 %description -l pl.UTF-8
111 AMaViS to skrypt pośredniczący pomiędzy agentem transferu poczty (MTA)
112 a jednym lub więcej programów antywirusowych i SpamAssasinem. Wersja
113 zdemonizowana.
114
115 %package -n openldap-schema-amavisd-new
116 Summary:        Amavisd-new LDAP schema
117 Summary(pl.UTF-8):      Schemat LDAP dla amavisd-new
118 Group:          Networking/Daemons
119 Requires:       openldap-servers
120
121 %description -n openldap-schema-amavisd-new
122 This package contains LDAP schema for use with amavisd-new.
123
124 %description -n openldap-schema-amavisd-new -l pl.UTF-8
125 Ten pakiet zawiera schemat LDAP do używania z amavisd-new.
126
127 %prep
128 %setup -q
129 %patch0 -p1
130 %patch1 -p1
131
132 %install
133 rm -rf $RPM_BUILD_ROOT
134 install -d $RPM_BUILD_ROOT%{_var}/spool/amavis/{runtime,virusmails,db} \
135         $RPM_BUILD_ROOT{%{_var}/run/amavisd,/etc/rc.d/init.d,%{_sbindir}} \
136         $RPM_BUILD_ROOT%{_tmpwatchdir}
137
138 install -p amavisd $RPM_BUILD_ROOT%{_sbindir}
139 install -p amavisd-agent $RPM_BUILD_ROOT%{_sbindir}
140 install -p amavisd-nanny $RPM_BUILD_ROOT%{_sbindir}
141 install -p amavisd-release $RPM_BUILD_ROOT%{_sbindir}
142 install -p amavisd-submit $RPM_BUILD_ROOT%{_sbindir}
143 cp -p amavisd.conf $RPM_BUILD_ROOT%{_sysconfdir}/amavisd.conf
144
145 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/amavisd
146 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_tmpwatchdir}/%{name}.conf
147
148 install -Dp LDAP.schema $RPM_BUILD_ROOT%{schemadir}/amavisd-new.schema
149
150 %clean
151 rm -rf $RPM_BUILD_ROOT
152
153 %pre
154 %groupadd -g 116 -r -f amavis
155 %useradd -u 97 -r -d %{_var}/spool/amavis -s /bin/false -c "Anti Virus Checker" -g amavis amavis
156
157 %postun
158 if [ "$1" = "0" ]; then
159         %userremove amavis
160         %groupremove amavis
161 fi
162
163 %post
164 /sbin/chkconfig --add amavisd
165 %service amavisd restart "Amavisd daemon"
166
167 %preun
168 if [ "$1" = "0" ]; then
169         %service amavisd stop
170         /sbin/chkconfig --del amavisd
171 fi
172
173 %post -n openldap-schema-amavisd-new
174 %openldap_schema_register %{schemadir}/amavisd-new.schema
175 %service -q ldap restart
176
177 %postun -n openldap-schema-amavisd-new
178 if [ "$1" = "0" ]; then
179         %openldap_schema_unregister %{schemadir}/amavisd-new.schema
180         %service -q ldap restart
181 fi
182
183 %files
184 %defattr(644,root,root,755)
185 %doc AAAREADME.first INSTALL RELEASE_NOTES README_FILES/* test-messages
186 %attr(755,root,root) %{_sbindir}/amavisd
187 %attr(755,root,root) %{_sbindir}/amavisd-agent
188 %attr(755,root,root) %{_sbindir}/amavisd-nanny
189 %attr(755,root,root) %{_sbindir}/amavisd-release
190 %attr(755,root,root) %{_sbindir}/amavisd-submit
191 %attr(754,root,root) /etc/rc.d/init.d/amavisd
192 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/amavisd.conf
193 %config(noreplace) %verify(not md5 mtime size) %{_tmpwatchdir}/%{name}.conf
194 %attr(750,amavis,amavis) %{_var}/spool/amavis
195 %attr(750,amavis,amavis) %{_var}/run/amavisd
196
197 %files -n openldap-schema-amavisd-new
198 %defattr(644,root,root,755)
199 %{schemadir}/*.schema