A Script to Automatically Update Clamav Packages — 2013

Five years ago I posted a script to automatically download and compile the latest clamav (an excellent open source multi-platform antivirus program).  Due to the reorganization of sourceforge, it needed to be updated.  Here it is:

#!/bin/sh
############################################
## Documentation:
## Please modify the url variable to the mirror closest to you.
############################################
#url="http://downloads.sourceforge.net/project/clamav/clamav/0.97/clamav-"
#urlend="?use_mirror=superb-sea2"
url="http://downloads.sourceforge.net/clamav/clamav-"
urlend=""
latest=`lynx -dump "http://www.clamav.net/download/sources" \
| grep "Latest stable release:" | awk '{print $5}' | head -1`
wget $url$latest.tar.gz$urlend && \
printf "The latest version of clamav or %s has been downloaded!\n" $latest && \
tar zxvf clamav-$latest.tar.gz && \
cd clamav-$latest
./configure --disable-zlib-vcheck &&
make && \
make install && \
printf "Ok I am updating to the latest virus definitions for \
version %s by running freshclam.", $latest && \
freshclam && \
cd ..