#!/bin/sh # # $Id: get_virus_update,v 0.1 2002/10/04 Exp $ # # the software is GNU licensing dependent. # Copyright (C) 2002, cudeso.be http://linux.cudeso.be # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTLY; without even the implied warranty of # MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General License for more details. # First declare some variables declare -i McDat # File-locations WGET=/usr/bin/wget LOGGER=/usr/bin/logger DRIFT_FILE=/home/AntiVirus/get_virus_update.drift OUTPUT_LOCATION=/home/AntiVirus/ OUTPUT_CURRENT_LOCATION=/home/AntiVirusCurrent/ # Variables WGET_OPTIONS="-q --tries=3" McURL=http://download.mcafee.com/products/licensed/superdat/english/intel/ # or ftp://ftp.nai.com/pub/antivirus/superdat/intel/ # thanks to Gareth Evans McDat=$(cat $DRIFT_FILE) McDatExtra=.exe # changed from McDatExtra=xdat.exe (Gareth Evans) McDatLeadIn=sdat # added 15-jul-04 by Gareth Evans McUpdateFile=$McDatLeadIn$McDat$McDatExtra # changed from McUpdateFile=$McDat$McDatExtra by Gareth Evans http_proxy=proxy.mydomain.com:3128 export http_proxy cd $OUTPUT_LOCATION # Build the execute string and do it res="$WGET $WGET_OPTIONS $McURL$McUpdateFile" ($res) # Did we get a file? if (test -f $McUpdateFile) then # If so, remove the old one let FutureMcDat=(McDat + 1) # and update the driftfile let OldMcDat=(McDat -1) echo $FutureMcDat > $DRIFT_FILE rm -f $OldMcDat$McDatExtra $LOGGER -p user.notice -t VIRUS_UPDATE "====== New dat-file $McUpdateFile =========" cp -f $McUpdateFile $OUTPUT_CURRENT_LOCATION/latestdat.exe else # We did not find anything echo "" > /dev/null # sit back fi