head	1.12;
access;
symbols
	RELEASE_6_1_0:1.11
	RELEASE_5_5_0:1.11
	RELEASE_6_0_0:1.10
	RELEASE_5_4_0:1.10
	RELEASE_4_11_0:1.10
	RELEASE_5_3_0:1.8
	RELEASE_4_10_0:1.5
	RELEASE_5_2_1:1.5
	RELEASE_5_2_0:1.5
	RELEASE_4_9_0:1.5
	RELEASE_5_1_0:1.5
	RELEASE_4_8_0:1.5
	RELEASE_5_0_0:1.5
	RELEASE_4_7_0:1.5
	RELEASE_4_6_2:1.5
	RELEASE_4_6_1:1.5
	RELEASE_4_6_0:1.5
	RELEASE_5_0_DP1:1.4
	RELEASE_4_5_0:1.4
	RELEASE_4_4_0:1.1
	RELEASE_4_3_0:1.1
	RELEASE_4_2_0:1.1
	RELEASE_4_1_1:1.1;
locks; strict;
comment	@# @;


1.12
date	2006.05.14.17.39.29;	author jeh;	state dead;
branches;
next	1.11;

1.11
date	2005.10.04.16.38.25;	author jeh;	state Exp;
branches;
next	1.10;

1.10
date	2004.10.27.18.13.16;	author jeh;	state Exp;
branches;
next	1.9;

1.9
date	2004.10.20.17.20.53;	author jeh;	state Exp;
branches;
next	1.8;

1.8
date	2004.08.30.10.16.41;	author jeh;	state Exp;
branches;
next	1.7;

1.7
date	2004.07.20.11.39.02;	author jeh;	state Exp;
branches;
next	1.6;

1.6
date	2004.07.20.00.15.00;	author jeh;	state Exp;
branches;
next	1.5;

1.5
date	2002.05.04.01.00.21;	author jeh;	state Exp;
branches;
next	1.4;

1.4
date	2001.11.01.01.27.47;	author jeh;	state Exp;
branches;
next	1.3;

1.3
date	2001.10.03.20.16.33;	author jeh;	state Exp;
branches;
next	1.2;

1.2
date	2001.09.27.11.15.17;	author jeh;	state Exp;
branches;
next	1.1;

1.1
date	2000.09.02.23.35.09;	author kris;	state Exp;
branches;
next	;


desc
@@


1.12
log
@Remove the DAT only port since it is now brough in live in the scanner port
@
text
@#!/bin/sh
#
# $Id$
#
cd @@PREFIX@@/libexec/uvscan/

# Force a low default and then get the current version's value
cur_AVVER="1"
if [ -f "file_id.diz" ]; then
	cur_AVVER="`tail -1 file_id.diz | sed -e 's/^(\(4[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/^\(4[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
@


1.11
log
@Update update_dat to use fetch and be a little more robust.  Thanks to
Sztankay Zsolt for the work.
@
text
@@


1.10
log
@Remove a DAT file that didn't completely download because it is not useful
and make refetching easier
@
text
@d9 2
a10 2
if [ -f file_id.diz ]; then
	cur_AVVER=`tail -1 file_id.diz | sed -e 's/^(\(4[0-9]*\)).*$/\1/'`
d14 3
a16 2
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/'`
d21 1
a21 1
		mv $i $i.old
d23 7
a29 11
	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
	else
		rm -f dat-$AVVER.tar
	fi
d31 1
@


1.9
log
@Base if the last update was successful on the dontents of file_id.diz,
since that is in the .tar and will only update after a successful download
and extract

Submitted By:		Steven Guerin
@
text
@d19 6
a24 3
	if [ ! -f dat-$AVVER.tar ]; then
		for i in *.tar ; do
			mv $i $i.old
d26 3
a28 8
		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
d30 2
@


1.8
log
@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.
@
text
@d9 2
a10 2
if [ -f update.ini ]; then
	cur_AVVER=`grep DATVersion update.ini | head -1 | cut -f2 -d= | sed -e 's/^\(4[0-9]*\).$/\1/'`
@


1.7
log
@Revert to honoring PREFIX.  No revision bump, cause it will be picked up
with tomorrows DAT update
@
text
@d6 8
d16 6
a21 7
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
d23 8
a30 3
		if tar xf dat-$AVVER.tar ; then
			rm -f *.old
			echo `date` Successfully updated AntiVirus DAT files to $AVVER
@


1.6
log
@Fix to use update.ini, since readme.txt no longer has version information.

Submitted by:		Blaz Zupan <blaz@@amis.net>
@
text
@d5 1
a5 1
cd /usr/local/libexec/uvscan/
@


1.5
log
@* Update to 4201
* Update update_dat to support their slightly changed format
@
text
@d6 2
a7 2
ftp http://download.nai.com/products/datfiles/4.x/nai/readme.txt >/dev/null
AVVER=`grep DAT readme.txt | head -5 | grep '[^0-9]4[0-9][0-9][0-9][^0-9]' | head -1 | sed -e 's/^.*[^0-9]\(4[0-9]*\)[^0-9].*$/\1/'`
@


1.4
log
@Update again.  This time only search of 4xxx in top 5 lines.
@
text
@d5 1
a5 1
cd @@PREFIX@@/libexec/uvscan/
d7 1
a7 1
AVVER=`head -5 readme.txt | grep ' 4[0-9][0-9][0-9] ' | head -1 | sed -e 's/^.* \(4[0-9]*\) .*$/\1/'`
@


1.3
log
@Update to 4164

files/update_dat:
  Chase the ever changing version number format
@
text
@d7 1
a7 7
AVVER=`head -1 readme.txt | cut -d' ' -f11`
if [ "x$AVVER" = "x" ] ; then
  AVVER=`grep 'DAT [0-9]* Release Date' readme.txt | head -1 | sed -e 's/^.*DAT \([0-9]*\) Release Date.*$/\1/'`
fi
if [ "x$AVVER" = "x" ] ; then
  AVVER=`head -5 readme.txt | grep ' 4[0-9][0-9][0-9] ' | head -1 | sed -e 's/^.* \([0-9]*\) .*$/\1/'`
fi
@


1.2
log
@They seem to have changed the format of the readme.txt file and
broke our update_dat utility.  This should fix that.
@
text
@d2 3
d10 3
@


1.1
log
@This is a freebsd-native version of the McAfee virus scanner, for scanning
DOS/Windows files for viruses. This is trial software which may only
be used for 30 days without purchasing a retail version.

It includes a useful script (update_dat) for automatically downloading the
latest .dat files should the port become out of date.

Obtained from:	NetBSD
@
text
@d5 3
@

