freebsd-ports/security/vscan/files/update_dat
Rong-En Fan c1363171c7 - Fix problem with fetching newer dat files (>= 5000)
- Replace deprecated variable

PR:		ports/111417
Submitted by:	Larry Rosenman <ler at lerctr.org>
2007-04-18 17:18:41 +00:00

31 lines
928 B
Bash

#!/bin/sh
#
# $Id$
#
cd @PREFIX@/libexec/uvscan/
# Force a low default and then get the current version's value
cur_AVVER="1"
if [ -f pkgdesc.ini ]; then
cur_AVVER=`grep Version pkgdesc.ini | cut -f2 -d= |sed -e 's/^(\([45][0-9]+\)).*$/\1/'`
fi
# Find what the website has for the current version
fetch -q http://download.nai.com/products/datfiles/4.x/nai/update.ini || exit 1
AVVER="`grep DATVersion update.ini | head -1 | cut -f2 -d= | sed -e 's/^\([45][0-9]*\).$/\1/'`"
rm -f update.ini
# Check to make sure the requested version is "newer" then the current
if [ "$cur_AVVER" -lt "$AVVER" ]; then
for i in *.tar ; do
[ -f "$i" ] && mv $i $i.old
done
fetch -q http://download.nai.com/products/datfiles/4.x/nai/dat-$AVVER.tar || exit 1
for i in *.dat ; do
[ -f "$i" ] && cp -p $i $i.bak
done
tar xf dat-$AVVER.tar || exit 1
rm -f *.old
echo "`date` Successfully updated AntiVirus DAT files to $AVVER"
fi
exit 0