Rev 1 | Blame | Last modification | View Log | Download | RSS feed
#!/bin/bash## McAfee Antivirus Updater for Linux## Urs Beyerle, PSI#echoecho "***************************************"echo "* McAfee Antivirus Updater *"echo "***************************************"echoDOWNLOAD_DIR=/tmp/download-mcafee-datUVSCAN_DIR=/usr/local/uvscanDAT_URL=http://linux.web.psi.ch/mirror/antivirus/mcafee/pub/datfiles/englishupdate_failed (){echoecho "***************************************"echo "* Update failed. *"echo "***************************************"rm -rf $DOWNLOAD_DIRechoexit 1}update_success (){echoecho "***************************************"echo "* Update completed successfully. *"echo "***************************************"rm -rf $DOWNLOAD_DIRechoexit}update_notneeded (){echoecho "Nothing to be done..."rm -rf $DOWNLOAD_DIRechoexit}### create dir for downloadrm -rf $DOWNLOAD_DIRmkdir -p $DOWNLOAD_DIRcd $DOWNLOAD_DIR### get update.iniecho "Download update.ini"wget --quiet $DAT_URL/update.iniif [ ! -e update.ini ]; thenecho "Download failed."update_failedfi### do we need new Dat files?Version=$( grep "DATVersion=" update.ini | cut -d"=" -f 2 | head -n 1 | sed 's/\r//' )uvscan --version | grep $Versionif [ "$?" = "0" ]; thenupdate_notneededfi### get ZipFileNamedos2unix update.iniZipFileName=$( grep "FileName=dat-.*zip" update.ini | cut -d"=" -f 2 )if [ ! $ZipFileName ]; thenecho "Filename of dat-*.zip not found."update_failedfi### download $ZipFileNameecho "Download $ZipFileName ..."wget $DAT_URL/$ZipFileNameif [ ! -e $ZipFileName ]; thenecho "Download of $ZipFileName failed."update_failedfi### unzip and copy dat filesunzip $ZipFileNameDatFiles=$( ls *.dat )if [ ${#DatFiles} == 0 ]; thenecho "No dat files found."update_failedfiecho "Copy *.dat files to $UVSCAN_DIR:"for file in $DatFiles; docp -a $file $UVSCAN_DIR/if [ "$?" != "0" ]; thenecho "$file could not be copied."elseecho "$file copied."chmod 644 $UVSCAN_DIR/$filefidoneechouvscan --versionupdate_success