freebsd-ports/security/uvscan-dat/files/update_dat
James E. Housley 191abc148e I have been having a problem since the update to use update.ini instead
of readme.txt of flipping between two version of DAT.  'update_dat' now
compares the current value with the new one, before updating.
2004-08-30 10:16:41 +00:00

33 lines
942 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 update.ini ]; then
cur_AVVER=`grep DATVersion update.ini | head -1 | cut -f2 -d= | sed -e 's/^\(4[0-9]*\).$/\1/'`
fi
# Find what the website has for the current version
ftp http://download.nai.com/products/datfiles/4.x/nai/update.ini >/dev/null
AVVER=`grep DATVersion update.ini | head -1 | cut -f2 -d= | sed -e 's/^\(4[0-9]*\).$/\1/'`
# Check to make sure the requested version is "newer" then the current
if [ "$cur_AVVER" -lt "$AVVER" ]; then
if [ ! -f dat-$AVVER.tar ]; then
for i in *.tar ; do
mv $i $i.old
done
if ftp http://download.nai.com/products/datfiles/4.x/nai/dat-$AVVER.tar >/dev/null ; then
for i in *.dat ; do
cp -p $i $i.bak
done
if tar xf dat-$AVVER.tar ; then
rm -f *.old
echo `date` Successfully updated AntiVirus DAT files to $AVVER
fi
fi
fi
fi