RES: Mcafee autoupdate
Julian Field
mailscanner at ecs.soton.ac.uk
Fri Apr 11 19:13:21 IST 2003
Tony,
1 thing that worries me slightly. You do a
CMD="uvscan --dat $DATDIR --version 2>&1"
echo '> OUT=$('$CMD')'
OUT=$($CMD)
What happens when /opt/uvscan isn't on your path?
At 18:08 11/04/2003, you wrote:
>Roberto Campos <roberto at MEUPROVEDOR.COM.BR> wrote:
> >Ok, so it's not working.
> >I've tryed it my own and it's reporting this:
> >#McAfee update failed: cannot find the update file, Connection timed out
> >at /usr/lib/MailScanner/mcafee-autoupdate line 99.
>
>That's an indication of network problems.
>
>I've posted this before, but the current version of my uvscan-update
>script is even more careful than it was. Unfortunately I can't edit the
>version in the faq-o-matic; I can only append which is ugly and leads to
>repetition. (You also can't fix broken item titles, which is a bit ugly.
>Perhaps it should be a wiki instead...)
>
> #!/bin/sh -e
> #
> # Update the McAfee data files.
> #
> # $Cambridge: hermes/build/bin/uvscan-update,v 1.14 2003/04/11
> 16:57:33 fanf2 Exp $
>
> LIBDIR=/opt/uvscan
>
> FTPDIR=ftp://ftpeur.nai.com/pub/antivirus/datfiles/4.x
>
> # version number pattern
> MATCH=[0-9][0-9][0-9][0-9]
>
> # work out latest dat version
> SED="/^DATVersion=\($MATCH\).$/!d;s//\1/;q"
> VERSION=$(wget -q -O- $FTPDIR/update.ini | sed -e "$SED")
>
> DATDIR=$LIBDIR/$VERSION
> FILE=dat-$VERSION.tar
>
> badversion () {
> echo Failed to get McAfee datfile update from "$FTPDIR"
> echo FTP version number "\"$VERSION\"" "$@"
> exit 1
> }
>
> # check the format of the version number
> case $VERSION in
> $MATCH) : ok
> ;;
> *) badversion does not match "$MATCH"
> ;;
> esac
>
> # already got it?
> if [ -d $DATDIR ]
> then
> # keep cron quiet by default
> case $1 in
> -v) echo Already have "$VERSION"
> esac
> exit
> fi
>
> # work out installed dat version
> cd $LIBDIR
> if ls -d $MATCH >/dev/null 2>&1
> then
> INSTALLED=$(ls -d $MATCH | tail -1)
> else
> # no installed version so get whatever is available
> INSTALLED=0000
> fi
>
> # check new version is actually newer
> if [ $VERSION -lt $INSTALLED ]
> then
> badversion older than installed "$INSTALLED"
> fi
>
> echo Installed dat file is "$INSTALLED"
> echo Latest dat file is "$VERSION"
>
> # now we are verbose
> run() {
> echo ">" "$@"
> "$@"
> }
>
> # fetch and extract dat files
> run mkdir $DATDIR
> run cd $DATDIR
> run wget --progress=dot:mega $FTPDIR/$FILE
> run tar xvf $FILE
>
> # verify the contents
> fail () {
> echo "$OUT"
> echo Test run failed -- removing bad McAfee data files
> run rm -rf $DATDIR
> exit 1
> }
> trap fail EXIT
> CMD="uvscan --dat $DATDIR --version 2>&1"
> echo '> OUT=$('$CMD')'
> OUT=$($CMD)
> case "$OUT" in
> *"Missing or invalid DAT"* | \
> *"Data file not found"* | \
> *"Removal datafile clean.dat not found"* | \
> *"Unable to remove viruses"* )
> fail
> ;;
> esac
> trap EXIT
>
> echo "$OUT"
> echo Update OK
> # change the current dat file links
> run cd $LIBDIR
> run ln -sf $VERSION/*.dat .
> # remove some crap
> run cd $DATDIR
> run rm -f *.exe *.tar *.txt
>
> echo
> echo Completed OK
>
> # done
>
>Tony.
>--
>f.a.n.finch <dot at dotat.at> http://dotat.at/
>BISCAY: EASTERLY 4 IN NORTH AT FIRST, OTHERWISE WEST BACKING SOUTHEAST 5 TO 7.
>RAIN OR SHOWERS. MODERATE OR GOOD.
--
Julian Field
www.MailScanner.info
Professional Support Services at www.MailScanner.biz
MailScanner thanks transtec Computers for their support
More information about the MailScanner
mailing list