#!/bin/sh # Created by Olivier Clavel on 10/10/2001 # Olivier.Clavel@tecfa.unige.ch # # 1- Deletes the last sdatxxxx.exe, dat-xxxx.zip # and update.ini files from the sources directory # 2- grabs new sdatxxxx.exe, dat-xxxx.zip and update.ini # file from Network Associate ftp Site # 3- saves new files in sources directory # 4- copies the new files in the samba-shared autoupgrade # directory renaming sdatxxxx.exe as Setup.exe # # ToDo: check if file version has changed on the FTP directory # so we don't download if it is the same version as we # already have # ######## # Included in crontab for Clavel this way # # /* this sets emacs as default editor */ # tcsh> setenv EDITOR /local/go/em # # /* this launches edition of the crontab file */ # tcsh> crontab -e # /* edit only this way for cron to be aware */ # # em> 0 5 * * 0-6 $HOME/bin/getvirusdef > /dev/null # save (C-x C-s) and quit (C-x C-c) emacs # # So that script runs every day at 05:00 # See "man crontab" for more details. ############### # # WARNING : the default shell for cron is sh and # the default path /usr/bin. So the path to programs # anywhere else has to be explicit (e.i. /local/bin/wget) # # WARNING2 : in order to run this script # you NEED wget version 1.7 minimum because ftp.nai.com runs # on a Windows OS and there is a compatibility issue with # older versions of Wget. # ####################################### # VARIABLE DEFINITION: Change here to # # suit your needs # ####################################### # This is the directory where the virusdef are initialy copied from $FTPDIR SOURCEDIR="/micros/micros/src/accessoires/sys/virusscan/4/update" # This the shared directory that PC use to update MacAfee VirusScan. # The virusdef are copied here from $SOURCEDIR UPDATEDIR="/micros/winapp/virus-upgrade" # This is the FTP directory where we get the virusdef from FTPDIR="ftp://ftp.nai.com/pub/antivirus/datfiles/4.x" # This the generic name of the dat only file DATFILE="dat-????.zip" # This is the generic name of the dat+engine file SDATFILE="sdat????.exe" # This is the name we give to the sdatfile when we copy it # to the $UPDATEDIR UPDATEFILENAME="Setup.exe" # This is the name of the update file (needed for some MacAfee versions) INIFILE="update.ini" # This is the full path to wget WGETPATH="/local/bin/wget" ############################## # END OF VARIABLE DEFINITION # # starting doing real things # ############################## # Prior to anything we kill the files in $SOURCEDIR find $SOURCEDIR \( -name $SDATFILE -o -name $DATFILE -o -name $INIFILE \) -exec /usr/bin/rm {} \; # We get $DATFILE from $FTPDIR in $SOURCEDIR ... $WGETPATH -P $SOURCEDIR $FTPDIR/$DATFILE # ... and copy it to $UPDATEDIR as is find $SOURCEDIR -name $DATFILE -exec cp {} $UPDATEDIR/. \; # Then we get the $SDATFILE from $FTPDIR in $SOURCEDIR ... $WGETPATH -P $SOURCEDIR $FTPDIR/$SDATFILE # ... and copy it as $UPDATEFILENAME in $UPDATEDIR. find $SOURCEDIR -name $SDATFILE -exec cp {} $UPDATEDIR/$UPDATEFILENAME \; # Finaly we get the $INIFILE (needed for some versions of MacAfee) ... $WGETPATH -P $SOURCEDIR $FTPDIR/$INIFILE # ... and copy it to the to the $UPDATEDIR as is find $SOURCEDIR -name $INIFILE -exec cp {} $UPDATEDIR/. \; # We are done, virus softwares can be updated or upgraded.