Subversion Repositories livecd

Rev

Rev 1 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 beyerle@PS 1
#!/bin/bash
2
#
3
# McAfee Antivirus Updater for Linux
4
# 
169 beyerle@PS 5
# Urs Beyerle
1 beyerle@PS 6
#
7
 
8
echo
9
echo "***************************************"
10
echo "* McAfee Antivirus Updater            *"
11
echo "***************************************"
12
echo
13
 
14
DOWNLOAD_DIR=/tmp/download-mcafee-dat
15
UVSCAN_DIR=/usr/local/uvscan
16
DAT_URL=http://linux.web.psi.ch/mirror/antivirus/mcafee/pub/datfiles/english
17
 
18
 
19
update_failed ()
20
{
21
    echo
22
    echo "***************************************"
23
    echo "* Update failed.                      *"
24
    echo "***************************************"
25
    rm -rf $DOWNLOAD_DIR
26
    echo
27
    exit 1
28
}
29
 
30
update_success ()
31
{
32
    echo
33
    echo "***************************************"
34
    echo "* Update completed successfully.      *"
35
    echo "***************************************"
36
    rm -rf $DOWNLOAD_DIR
37
    echo
38
    exit
39
}
40
 
41
update_notneeded ()
42
{
43
    echo
44
    echo "Nothing to be done..."
45
    rm -rf $DOWNLOAD_DIR
46
    echo
47
    exit
48
}
49
 
50
### create dir for download
51
rm -rf $DOWNLOAD_DIR
52
mkdir -p $DOWNLOAD_DIR
53
cd $DOWNLOAD_DIR
54
 
55
### get update.ini
56
echo "Download update.ini"
57
wget --quiet $DAT_URL/update.ini
58
if [ ! -e update.ini ]; then
59
    echo "Download failed."
60
    update_failed
61
fi
62
 
63
### do we need new Dat files?
64
Version=$( grep "DATVersion=" update.ini | cut -d"=" -f 2 | head -n 1 | sed 's/\r//' )
65
uvscan --version | grep $Version
66
if [ "$?" = "0" ]; then
67
    update_notneeded
68
fi
69
 
70
### get ZipFileName
71
dos2unix update.ini
72
ZipFileName=$( grep "FileName=dat-.*zip" update.ini | cut -d"=" -f 2 )
73
if [ ! $ZipFileName ]; then
74
    echo "Filename of dat-*.zip not found."
75
    update_failed
76
fi
77
 
78
### download $ZipFileName
79
echo "Download $ZipFileName ..."
80
wget $DAT_URL/$ZipFileName
81
if [ ! -e $ZipFileName ]; then
82
    echo "Download of $ZipFileName failed."
83
    update_failed
84
fi
85
 
86
### unzip and copy dat files
87
unzip $ZipFileName
88
DatFiles=$( ls *.dat )
89
if [ ${#DatFiles} == 0 ]; then
90
    echo "No dat files found."
91
    update_failed    
92
fi
93
 
94
echo "Copy *.dat files to $UVSCAN_DIR:"
95
for file in $DatFiles; do
96
    cp -a $file $UVSCAN_DIR/
97
    if [ "$?" != "0" ]; then
98
	echo "$file could not be copied."
99
    else
100
	echo "$file copied."
101
	chmod 644 $UVSCAN_DIR/$file
102
    fi
103
done
104
 
105
echo 
106
uvscan --version
107
update_success