Summary: Clam Anti-Virus Name: clamav Version: 0.96.2 Release: 1 License: GPL Group: System/Base Source: %{name}-%{version}.tar.gz Packager: Jonathan Norman %description ClamAV is an open source anti-virus toolkit of UNIX. This runs as a demon and can be at any time by the user to scan directories. %prep %setup -q %build ./configure --prefix=/usr --sysconfdir=/etc \ --with-zlib=/usr --with-dbdir=/var/lib/clamav \ --disable-clamav make %install rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install mkdir -pv $RPM_BUILD_ROOT/etc/rc.d/{rc{0,1,2,3,4,5,6},init}.d #bootscripts cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav << "EOF" #!/bin/sh # Begin $rc_base/init.d/clamav . /etc/sysconfig/rc . ${rc_functions} case "${1}" in start) boot_mesg "Starting ClamAV Daemon..." loadproc /usr/sbin/clamd ;; stop) boot_mesg "Stopping ClamAV Daemon..." killproc /usr/sbin/clamd ;; restart) ${0} stop sleep 1 ${0} start ;; status) statusproc /usr/sbin/clamd ;; *) echo "Usage: ${0} {start|stop|restart|status}" exit 1 ;; esac # End $rc_base/init.d/clamav EOF chmod -v 754 $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav for link in $RPM_BUILD_ROOT/etc/rc.d/rc{0,1,6}.d/K32clamav; do ln -sfv ../init.d/clamav $link; done for link in $RPM_BUILD_ROOT/etc/rc.d/rc{2,3,4,5}.d/S18clamav; do ln -sfv ../init.d/clamav $link; done #Removed 'Example' from freshclam.conf so it works 'out of the box' sed 's/^Example/#&/' -i $RPM_BUILD_ROOT/etc/freshclam.conf sed 's@#DatabaseDirectory /var/lib@DatabaseDirectory /usr/share@' \ -i $RPM_BUILD_ROOT/etc/freshclam.conf # Gets clamd.conf to work out of the box and changes db dir sed 's/^Example/#&/' -i $RPM_BUILD_ROOT/etc/clamd.conf sed 's@#DatabaseDirectory /var/lib@DatabaseDirectory /usr/share@' \ -i $RPM_BUILD_ROOT/etc/clamd.conf %post cat /etc/group | grep clamav > /dev/null if [ $? != 0 ];then echo "Adding group \"clamav\"" groupadd -g 36 clamav fi cat /etc/passwd | grep clamav > /dev/null if [ $? != 0 ];then echo "Adding user \"clamav\"" useradd -c "ClamAV Daemon" -d /dev/null -u 36 -g clamav -s /bin/false clamav fi if [ ! -f /usr/share/clamav ];then mkdir -v /usr/share/clamav chown -vR clamav:clamav /usr/share/clamav fi if [ ! -f /usr/share/clamav/main.cvd ];then wget -P /usr/share/clamav http://db.local.clamav.net/main.cvd chmod -vR 600 /usr/share/clamav/main.cvd fi if [ ! -f /usr/share/clamav/daily.cvd ];then wget -P /usr/share/clamav http://db.local.clamav.net/daily.cvd chmod -vR 600 /usr/share/clamav/daily.cvd fi touch /var/log/freshclam.log && chmod 600 /var/log/freshclam.log && chown clamav /var/log/freshclam.log freshclam # start clam demon /etc/rc.d/init.d/clamav start %postun #userdel clamav #groupdel clamav #rm -v /etc/rc.d/init.d/clamav #for link in /etc/rc.d/rc{{0,1,6}.d/K32,{2,3,4,5}.d/S18}clamav; do # rm -fv ../init.d/clamav $link; #done #rm -vR /usr/share/clamav /var/log/freshclam.log %pre if [ -f /etc/rc.d/init.d/clamav ];then /etc/rc.d/init.d/clamav stop fi %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) / %changelog * Tue Aug 17 2010 Jonathan Norman 0.96.2-1 - Upgraded from 0.95.3 to 0.96.2 * Sun Nov 1 2009 Jonathan Norman 0.95.3-1 - Upgraded from 0.95.2 to 0.95.3 - Start the demon after installtion - Stop the demon if there is one before installing - Removed post-uninstall commands due to upgrade problem - Downloads virus database files if they don't exsist - Runs freshclam after installing clamav * Wed Jul 29 2009 Jonathan Norman 0.95.2-1 - Upgraded from 0.95.1 to 0.95.2 - Only creates user and group if not already on the system - Creates directories if needed - Added a sed to remove 'Example' from freshclam.conf - Added a sed to remove 'Example' from clamd.conf - Added seds to change database directory * Wed Mar 25 2009 Jonathan Norman 0.95.1-1 - Created user and group - Bootscript for daemon - Creates logs - Downloads anti-virus database - Moved bootscripts to %install - Removed list of commands from %post to fix /bin/sh to zsh problem