Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to automate clamav package updates' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to automate clamav package updates
Authored by: smkolins on May 03, '06 02:12:18PM

sorry - thought I had it licked but this one actually finishes...

#!/bin/sh
############################################
## Documentation:
## This script downloads the latest version of clamav and installs
## it compatibly with ClamXav based on work here http://www.macosxhints.com/article.php?
##<linewrapped>story=20060409060940665&query=clam
## My example uses a download from the east coast - see
## http://prdownloads.sourceforge.net/clamav/ clamav-0.88.2.tar.gz?download
## for an example of the possible downloads as of version 0.88.2
## note the download urls are not displayed but check the path of the actual download
## most of my comments follow the line of code
## I document for learning as well as documenting purposes
## the next thing this should do I think is hide all the text flying by,
## report success or not
## and be included as a program or plugin to clamXav
## note this only updates the engine. An installation of ClamXav will do other things
## and should be done BEFORE doing this update.
############################################
url=" http://superb-east.dl.sourceforge.net/sourceforge/clamav/clamav-"
# this is a variable which has most of the download url, it's missing the
# version number
# the following line downloads a url as a file in the default location and it will have the latest version in the html of the file
#<linewrapped>downloaded
latest=`curl -O "http://www.clamav.net/stable.php#pagestart" \
; grep "released (" stable.php* | awk '{print $2}' | head -1`
# this line searches the file named stable.php{anything} for "released ("
# and backs up to the version number in this line of text
curl -O $url$latest.tar.gz && \
# this downloads the resulting file name as a file of the same name
printf "The latest version of clamav or %s has been downloaded!\n" $latest && \
tar zxvf clamav-$latest.tar.gz && \
cd clamav-$latest
./configure --prefix=/usr/local/clamXav &&
# this tells the compiler to install the comilation in the clamXav compatible location
make && \
sudo make install && \
# the following lines reset permissions as needed by clamXav as documented at
# http://markallan.co.uk/clamXav/index.php?page=byo
chown -R root /usr/local/clamXav
chgrp -R admin /usr/local/clamXav
chmod -R 666 /usr/local/clamXav/etc/freshclam.conf
chmod u+s /usr/local/clamXav/bin/freshclam
chmod a+wr /usr/local/clamXav/share/clamav/freshclam.log
chown -R clamav /usr/local/clamXav/share/clamav
chgrp -R clamav /usr/local/clamXav/share/clamav
chmod -R g+w /usr/local/clamXav/share/clamav
chmod -R u+w /usr/local/clamXav/share/clamav
printf "Ok I am updating to the latest virus definitions for \
version %s by running freshclam.", $latest && \
/usr/local/clamXav/bin/freshclam && \
# these steps clean up all the stuff downloaded and or created
cd ..
rm -Rf cd clamav-$latest
rm -f clamav-$latest.tar.gz
rm -f stable.php*

---
Possess a pure, kindly, and radiant heart!



[ Reply to This | # ]