Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed
#!/bin/bash
#
# McAfee Antivirus Updater for Linux
#
# Urs Beyerle, PSI
#
echo
echo "***************************************"
echo "* McAfee Antivirus Updater *"
echo "***************************************"
echo
DOWNLOAD_DIR=/tmp/download-mcafee-dat
UVSCAN_DIR=/usr/local/uvscan
DAT_URL=http://linux.web.psi.ch/mirror/antivirus/mcafee/pub/datfiles/english
update_failed ()
{
echo
echo "***************************************"
echo "* Update failed. *"
echo "***************************************"
rm -rf $DOWNLOAD_DIR
echo
exit 1
}
update_success ()
{
echo
echo "***************************************"
echo "* Update completed successfully. *"
echo "***************************************"
rm -rf $DOWNLOAD_DIR
echo
exit
}
update_notneeded ()
{
echo
echo "Nothing to be done..."
rm -rf $DOWNLOAD_DIR
echo
exit
}
### create dir for download
rm -rf $DOWNLOAD_DIR
mkdir -p $DOWNLOAD_DIR
cd $DOWNLOAD_DIR
### get update.ini
echo "Download update.ini"
wget --quiet $DAT_URL/update.ini
if [ ! -e update.ini ]; then
echo "Download failed."
update_failed
fi
### do we need new Dat files?
Version=$( grep "DATVersion=" update.ini | cut -d"=" -f 2 | head -n 1 | sed 's/\r//' )
uvscan --version | grep $Version
if [ "$?" = "0" ]; then
update_notneeded
fi
### get ZipFileName
dos2unix update.ini
ZipFileName=$( grep "FileName=dat-.*zip" update.ini | cut -d"=" -f 2 )
if [ ! $ZipFileName ]; then
echo "Filename of dat-*.zip not found."
update_failed
fi
### download $ZipFileName
echo "Download $ZipFileName ..."
wget $DAT_URL/$ZipFileName
if [ ! -e $ZipFileName ]; then
echo "Download of $ZipFileName failed."
update_failed
fi
### unzip and copy dat files
unzip $ZipFileName
DatFiles=$( ls *.dat )
if [ ${#DatFiles} == 0 ]; then
echo "No dat files found."
update_failed
fi
echo "Copy *.dat files to $UVSCAN_DIR:"
for file in $DatFiles; do
cp -a $file $UVSCAN_DIR/
if [ "$?" != "0" ]; then
echo "$file could not be copied."
else
echo "$file copied."
chmod 644 $UVSCAN_DIR/$file
fi
done
echo
uvscan --version
update_success