ðÒÉ×ÅÔ ÎÁÒÏÄ.
ëÔÏ ÎÉÂÕÄØ ÐÉÓÁÌ spec-ÆÁÊÌ ÄÌÑ ÎÏ×ÏÇÏ clamav 0.91.2 . õ ÍÅÎÑ ÓÔÁÒÁÑ ÓÉÓÔÅÍÁ ÄÏÓÔÁ×ÛÁÑÓÑ ÅÝ£ ÏÔ ÐÒÅÄÙÄÕÝÅÇÏ ÁÄÍÉÎÁ ÎÁ Mandrive 10.0. óÔÁÎÄÁÒÔÎÙÅ rpm ÔÕÄÁ ÎÅ ×ÓÔÁÀÔ. ðÏ ÜÔÏÍÕ Ñ ÈÏÔÅÌ ÓÄÅÌÁÔØ Ó×ÏÊ rpm, ÎÏ ÎÅ ÚÎÁÀ ËÁË ÓÏÚÄÁÔØ ÜÔÏÔ spec.ìÉÔÅÒÁÔÕÒÕ ÞÉÔÁÌ ÎÏ ÔÁÍ ÐÏ ÜÔÏÍÕ ÏÐÉÓÁÎÏ ÍÉÎÉÍÕÍ, ÎÉÞÅÇÏ ËÏÎËÒÅÔÎÏÇÏ.
ñ ÎÁÐÉÓÁÌ Ó×ÏÊ spec ÆÁÊÌ ÎÏ ÏÎ ÔÏÌØËÏ ÓÏÚÄÁ£Ô × BUILD ÐÁÐËÕ clamav-0.91.2 É ÒÁÓÐÁËÏ×Ù×ÁÅÔ ÔÕÄÁ tar ÁÒÈÉ× É ÄÏÂÁ×ÌÑÅÔ ÎÏ×ÕÀ ÐÁÐËÕ Mandriva, Á ËÚØ ÎÅ ÓÏÚÄÁ£ÔÓÑ.
×ÏÔ ÜÔÏÔ specÞfine name clamav
Þfine version 0.91.2Þfine major 1
Þfine libname %mklibname %{name} %{major}Þfine milter 0
#compatability macros:
%{?!mkrel:Þfine mkrel(c:) %{-c:0.%{-c*}.}%{!?_with_unstable:%(perl -e '$_="%{1}";m/(.\*\\D\+)?(\\d+)$/;$rel=${2}-1;re;print "$1$rel";').%{?subrel:%subrel}%{!?subrel:1}.%{?distversion:%distversion}%{?!distversion:%(echo $[%{mdkversion}/10])}}%{?_with_unstable:%{1}}%{?distsuffix:%distsuffix}%{?!distsuffix:mdk}}%{?_with_milter: %{expand: %%global milter 1}}
%{?_without_milter: %{expand: %%global milter 0}}Summary: An anti-virus utility for Unix
Name: %{name}
Version: %{version}
Release: 1
License: GPL
Group: File tools
URL: http://clamav.sourceforge.net/
Source0: %{name}-%{version}.tar.gz
Source1: clamav-clamd.init.bz2
Source2: clamav-clamd.logrotate.bz2
Source3: clamav-freshclam.logrotate.bz2
Source4: clamav-freshclam.cron.bz2
Source5: clamd.conf.bz2
Source6: freshclam.conf.bz2
Requires(post): clamav-db
Requires(preun): clamav-db
Requires(post): %{libname} = %{version}
Requires(preun): %{libname} = %{version}
Requires(post): rpm-helper
Requires(preun): rpm-helper
Requires(pre): rpm-helper
Requires(postun): rpm-helper
BuildRequires: bzip2-devel
#BuildRequires: curl-devel
#BuildRequires: bc
%if %mdkversion >= 1000
#BuildRequires: autoconf2.5
#BuildRequires: automake1.7
%endif
%if %{milter}
BuildRequires: sendmail-devel
BuildRequires: tcp_wrappers-devel
%endif
BuildRequires: zlib-devel
BuildRequires: gmp-devel
#BuildRequires: curl-devel
%if %mdkversion >= 1020
BuildRequires: dos2unix
BuildRequires: multiarch-utils >= 1.0.3
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootÞscription
Clam AntiVirus is an anti-virus toolkit for Unix. The main purpose
of this software is the integration with mail seversions (attachment
scanning). The package provides a flexible and scalable
multi-threaded daemon, a commandline scanner, and a tool for
automatic updating via Internet. The programs are based on a
shared library distributed with the Clam AntiVirus package, which
you can use in your own software.You can build %{name} with some conditional build swithes;
(ie. use with rpm --rebuild):
--with[out] milter Build %{name}-milter (default)%package -n clamd
Summary: The Clam AntiVirus Daemon
Group: System/Servers
Requires: %{name} = %{version}
Requires(post): clamav-db
Requires(preun): clamav-db
Requires(post): %{libname} = %{version}
Requires(preun): %{libname} = %{version}
Requires(post): rpm-helper
Requires(preun): rpm-helper
Requires(pre): rpm-helper
Requires(postun): rpm-helperÞscription -n clamd
The Clam AntiVirus Daemon%if %{milter}
%package -n %{name}-milter
Summary: The Clam AntiVirus sendmail-milter Daemon
Group: System/Servers
Requires: %{name} = %{version}
Requires: clamd = %{version}
#Requires: sendmail
#Requires: tcp_wrappers
Requires(post): clamav-db
Requires(preun): clamav-db
Requires(post): %{libname} = %{version}
Requires(preun): %{libname} = %{version}
Requires(post): rpm-helper
Requires(preun): rpm-helper
Requires(pre): rpm-helper
Requires(postun): rpm-helperÞscription -n %{name}-milter
The Clam AntiVirus sendmail-milter Daemon
%endif%package -n %{name}-db
Summary: Virus database for %{name}
Group: Databases
Requires: %{name} = %{version}
Requires(post): rpm-helper
Requires(preun): rpm-helper
Requires(pre): rpm-helper
Requires(postun): rpm-helperÞscription -n %{name}-db
The actual virus database for %{name}%package -n %{libname}
Summary: Shared libraries for %{name}
Group: System/LibrariesÞscription -n %{libname}
Shared libraries for %{name}%package -n %{libname}-devel
Summary: Development library and header files for the %{name} library
Group: Development/C
Requires: %{libname} = %{version}
Provides: %{name}-devel lib%{name}-devel
Obsoletes: %{name}-devel lib%{name}-develÞscription -n %{libname}-devel
This package contains the static %{libname} library and its header
files.%prep
%setup -q -n %{name}-%{version}
# clean up
for i in `find . -type d -name CVS` `find . -type f -name .cvs\*` `find . -type f -name .#\*`; do
if [ -e "$i" ]; then rm -rf $i; fi >&/dev/null
done
#%patch0 -p1 -b .mdkconfmkdir -p Mandriva
bzcat %{SOURCE1} > Mandriva/clamav-clamd.init
bzcat %{SOURCE2} > Mandriva/clamav-clamd.logrotate
bzcat %{SOURCE3} > Mandriva/clamav-freshclam.logrotate
bzcat %{SOURCE4} > Mandriva/clamav-freshclam.cron
bzcat -f %{SOURCE5} > etc/clamd.conf
bzcat -f %{SOURCE6} > etc/freshclam.conf# strip away annoying ^M
%if %mdkversion >= 1020
find docs -type f -exec dos2unix -U {} \;
find contrib/Windows -type f -exec dos2unix -U {} \;
%endif%build
%if %mdkversion > 1000
export WANT_AUTOCONF_2_5=1
libtoolize --copy --force && aclocal-1.7 && autoconf && automake-1.7
%endifexport SENDMAIL="%{_libdir}/sendmail"
%serverbuild
%configure2_5x \
--disable-%{name} \
--with-user=%{name} \
--with-group=%{name} \
--with-dbdir=%{_localstatedir}/%{name} \
--enable-id-check \
--enable-clamuko \
--enable-bigstack \
--with-libcurl \
--with-zlib=%{_prefix} \
--disable-zlib-vcheck \
%if %{milter}
--enable-milter --with-tcpwrappers
%else
--disable-milter --without-tcpwrappers
%endif# --enable-debug \
%make
%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}%makeinstall_std
# install the init scripts
install -d %{buildroot}%{_initrddir}
install -m755 Mandriva/clamav-clamd.init %{buildroot}%{_initrddir}/clamd%if %{milter}
# install the init script
install -m755 Mandriva/clamav-milter.init %{buildroot}%{_initrddir}/clamav-milter
# install the milter config
install -d %{buildroot}%{_sysconfdir}/sysconfig
install -m644 Mandriva/clamav-milter.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}-milter
%endif# install the logrotate stuff
install -d %{buildroot}%{_sysconfdir}/logrotate.d
install -m644 Mandriva/clamav-clamd.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/clamd
install -m644 Mandriva/clamav-freshclam.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/freshclaminstall -d %{buildroot}%{_var}/log/%{name}
touch %{buildroot}%{_var}/log/%{name}/freshclam.log
touch %{buildroot}%{_var}/log/%{name}/clamd.log# install the update stuff
install -d %{buildroot}%{_sysconfdir}/cron.daily
install -d %{buildroot}%{_sysconfdir}/cron.hourly
install -m755 Mandriva/clamav-freshclam.cron %{buildroot}%{_sysconfdir}/cron.daily/freshclam
install -m755 Mandriva/clamav-freshclam.cron %{buildroot}%{_sysconfdir}/cron.hourly/freshclam# install config files
install -m644 etc/clamd.conf %{buildroot}%{_sysconfdir}/clamd.conf
install -m644 etc/clamd.conf %{buildroot}%{_sysconfdir}/clamav.conf
install -m644 etc/freshclam.conf %{buildroot}%{_sysconfdir}/freshclam.conf# pid file dir
install -d %{buildroot}%{_var}/run/%{name}# fix TMPDIR
install -d %{buildroot}%{_localstatedir}/%{name}/tmpcat > README.qmail+qmail-scanner <<EOF
#!/bin/sh
#
# The "temporary" qmail+qmail-scanner HOWTO
# -----------------------------------------
#
# For some unknown and undocumented reason clamdscan stopped working
# in the excellent qmail+qmail-scanner setup somewhere after the
# 20040103 CVS snapshot.
#
# To get it working again everything assigned to the clamav user has
# to be changed to the qscand user by hand.
#
# Hint: Change the config and chown the directories like this:
# (if you are lazy you could just execute this file)perl -pi -e "s|%{name} %{name}|qscand qscand|g" %{_sysconfdir}/logrotate.d/clamd
perl -pi -e "s|%{name} %{name}|qscand qscand|g" %{_sysconfdir}/logrotate.d/freshclam
perl -pi -e "s|^User %{name}|User qscand|g" %{_sysconfdir}/clamd.conf
perl -pi -e "s|^DatabaseOwner %{name}|DatabaseOwner qscand|g" %{_sysconfdir}/freshclam.confchown -R qscand:qscand %{_localstatedir}/%{name}
chown -R qscand:qscand %{_var}/log/%{name}
chown -R qscand:qscand %{_var}/run/%{name}if [ -x %{_initrddir}/clamd ]; then
%{_initrddir}/clamd restart
fiif [ -x %{_initrddir}/freshclam ]; then
%{_initrddir}/freshclam restart
fi# Regards // Oden Eriksson
EOF%if %mdkversion >= 1020
%multiarch_binaries %{buildroot}%{_bindir}/clamav-config
%endif%pre
%_pre_useradd %{name} %{_localstatedir}/%{name} /bin/shif ! [ -z "`getent group amavis`" ]; then
gpasswd -a %{name} amavis
fi%post
%_post_service freshclam
%create_ghostfile %{_var}/log/%{name}/freshclam.log %{name} %{name} 0644%preun
%_preun_service freshclam%pre -n clamd
%_pre_useradd %{name} %{_localstatedir}/%{name} /bin/sh%post -n clamd
%_post_service clamd
%create_ghostfile %{_var}/log/%{name}/clamd.log %{name} %{name} 0644%preun -n clamd
%_preun_service clamd%postun -n clamd
%_postun_userdel %{name}%if %{milter}
%post -n %{name}-milter
%_post_service %{name}-milter%preun -n %{name}-milter
%_preun_service %{name}-milter
%endif%pre -n %{name}-db
%_pre_useradd %{name} %{_localstatedir}/%{name} /bin/sh%post -n %{name}-db
# try to keep most uptodate database
for i in main daily; do
if [ -f %{_var}/lib/clamav/$i.cvd.rpmnew ]; then
if [ %{_var}/lib/clamav/$i.cvd.rpmnew -nt %{_var}/lib/clamav/$i.cvd ]; then
mv -f %{_var}/lib/clamav/$i.cvd.rpmnew %{_var}/lib/clamav/$i.cvd
else
rm -f %{_var}/lib/clamav/$i.cvd.rpmnew
fi
fi
done%postun -n %{name}-db
%_postun_userdel %{name}%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}%files
Þfattr(-,root,root)
%doc AUTHORS BUGS ChangeLog FAQ NEWS README test UPGRADE
%doc docs/*.pdf contrib/clamdwatch contrib/clamavmon
%doc README.qmail+qmail-scanner COPYING
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/clamav.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/freshclam.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/freshclam
%attr(0755,root,root) %config(noreplace) %{_sysconfdir}/cron.daily/freshclam
%attr(0755,root,root) %config(noreplace) %{_sysconfdir}/cron.hourly/freshclam%{_bindir}/clamscan
%{_bindir}/clamdscan
%{_bindir}/freshclam
%{_bindir}/sigtool
%{_bindir}/clamconf
%{_mandir}/man1/sigtool.1*
%{_mandir}/man1/clamdscan.1*
%{_mandir}/man1/clamscan.1*
%{_mandir}/man1/freshclam.1*
%{_mandir}/man5/clamd.conf.5*
%{_mandir}/man5/freshclam.conf.5*
%if !%{milter}
%exclude %{_mandir}/man8/%{name}-milter.8*
%endif
%dir %attr(0755,%{name},%{name}) %{_var}/run/%{name}
%dir %attr(0755,%{name},%{name}) %{_localstatedir}/%{name}
%dir %attr(0755,%{name},%{name}) %{_var}/log/%{name}
%ghost %attr(0644,%{name},%{name}) %{_var}/log/%{name}/freshclam.log%files -n clamd
Þfattr(-,root,root)
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/clamd.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/clamd
%attr(0755,root,root) %{_initrddir}/clamd
%{_sbindir}/clamd
%{_mandir}/man8/clamd.8*
%ghost %attr(0644,%{name},%{name}) %{_var}/log/%{name}/clamd.log%if %{milter}
%files -n %{name}-milter
Þfattr(-,root,root)
%doc %{name}-milter/INSTALL
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}-milter
%attr(0755,root,root) %{_initrddir}/%{name}-milter
%{_sbindir}/%{name}-milter
%{_mandir}/man8/%{name}-milter.8*
%endif%files -n %{name}-db
Þfattr(-,root,root)
%dir %attr(0755,%{name},%{name}) %{_localstatedir}/%{name}
%attr(0644,%{name},%{name}) %config(noreplace) %{_localstatedir}/%{name}/daily.cvd
%attr(0644,%{name},%{name}) %config(noreplace) %{_localstatedir}/%{name}/main.cvd
%dir %attr(0755,%{name},%{name}) %{_localstatedir}/%{name}/tmp%files -n %{libname}
Þfattr(-,root,root)
%{_libdir}/libclamav
%{_libdir}/libclamav.2.*%files -n %{libname}-devel
Þfattr(-,root,root)
%doc contrib/clamdwatch
%doc contrib/clamdmon
%{_bindir}/clamav-config
%{_includedir}/*
%{_libdir}/*.a
%{_libdir}/*.la
%{_libdir}/pkgconfig/libclamav.pc
%changelog
÷ÏÚØÍÉ ÇÏÔÏ×ÙÊ src.rpm ÏÔ ÌÀÂÏÇÏ ÄÉÓÔÒÉÂÕÔÉ×Á, ÇÄÅ ÏÎ ÅÓÔØ, ×ÙÔÁÝÉ ÏÔÔÕÄÁ spec É ÉÚÍÅÎÉ ÐÏÄ ÓÅÂÑ. á ÍÏÖÅÔ, ÐÒÏÓÔÏ ÅÇÏ (src.rpm) --rebuild ÐÒÏÊÄÅÔ.
>÷ÏÚØÍÉ ÇÏÔÏ×ÙÊ src.rpm ÏÔ ÌÀÂÏÇÏ ÄÉÓÔÒÉÂÕÔÉ×Á, ÇÄÅ ÏÎ ÅÓÔØ, ×ÙÔÁÝÉ ÏÔÔÕÄÁ spec
>É ÉÚÍÅÎÉ ÐÏÄ ÓÅÂÑ. á ÍÏÖÅÔ, ÐÒÏÓÔÏ ÅÇÏ (src.rpm) --rebuild ÐÒÏÊÄÅÔ.×ÏÐÒÏÓ ËÁË ÉÚÍÅÎÉÔØ?
ñ ÜÔÏÔ spec ÓÔÁÝÉÌ ÓÏ ÓÔÁÒÏÊ ×ÅÒÓÉÉ 0.90.2.
þÔÏ ÉÍÅÎÎÏ ÔÁÍ ÎÁÄÏ ÉÚÍÅÎÑÔØ?
á ÐÒÏÓÔÏ Ó ÎÉÍ - ÎÅ ÓÏÂÉÒÁÅÔÓÑ? íÏÖÅÔ, ×ÓÅ-ÔÁËÉ ÎÁÊÄÅÛØ src.rpm 0.91.2?
íÏÊ ÓÏ×ÅÔ - ÎÅ ÍÕÞÁÊÓÑ ÓÏÂÅÒÉ ÉÚ ÓÙÒÃÏ×.
Spec ÜÔÏ ÐÒÅÖÄÅ ×ÓÅÇÏ ÚÁ×ÉÓÉÍÏÓÔÉ
>[Ï×ÅÒË×ÏÔÉÎÇ ÕÄÁÌÅÎ]
>Þfattr(-,root,root)
>%doc contrib/clamdwatch
>%doc contrib/clamdmon
>%{_bindir}/clamav-config
>%{_includedir}/*
>%{_libdir}/*.a
>%{_libdir}/*.la
>%{_libdir}/pkgconfig/libclamav.pc
>
>%changelog
>íÏÊ ÓÏ×ÅÔ - ÎÅ ÍÕÞÁÊÓÑ ÓÏÂÅÒÉ ÉÚ ÓÙÒÃÏ×.
>Spec ÜÔÏ ÐÒÅÖÄÅ ×ÓÅÇÏ ÚÁ×ÉÓÉÍÏÓÔÉÁ ÉÚ src ËÁË ÓÏÚÄÁÔØ ÏÂÙÞÎÙÊ rpm?
rpmrebuild [option] <packagename>
or
rpm --rpmrebuild [option] <packagename>