A script to automate clamav package updates

Apr 14, '06 05:27:00AM

Contributed by: macubergeek

ClamAV is an open source antivirus product. You can update the virus definitions by running the command freshclam in Terminal. The only shortcoming of the packages is that when the clamav package itself is updated, you have to surf to the sourceforge site, download the latest tarball, compile it and install it.

This shell script automates all of this:

#!/bin/sh
############################################
## Documentation:
## This script downloads the latest version of clamav and installs
## it. I've used the download mirror in Phoenix Arizona. You should
## modify the url variable to the mirror closest to you.
############################################
url="http://easynews.dl.sourceforge.net/sourceforge/clamav/clamav-"
latest=`lynx -dump "http://www.clamav.net/stable.php#pagestart" \
| grep "   clamav" | awk '{print $2}' | head -1`
wget $url$latest.tar.gz && \
printf "The latest version of clamav or %s has been downloaded!\n" $latest && \
tar zxvf clamav-$latest.tar.gz && \
cd clamav-$latest
./configure &&
make && \
sudo make install && \
printf "Ok I am updating to the latest virus definitions for \
version %s by running freshclam.", $latest && \
freshclam && \
cd ..
rm -rf cd clamav-$latest

[robg adds: I haven't tested this one -- there's also a GUI version of ClamAV for OS X called ClamXav, if you'd like to try it out without the command line work.]

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060409060940665