-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Buchan Milne wrote on Tue, Mar 04, 2003 at 05:55:08PM +0200 :
> 
> managed to get the KAV stuff to work right, but haven't bothered since
> we now use Sophos).

I too really like sophos.  The following might be handy for you if
you're not already doing it, or useful for someone else who uses sophos
sweep on their samba server:

[EMAIL PROTECTED] ~]# cat bin/get_ides 
#!/bin/bash

PATH=/usr/local/bin:/usr/local/sbin:$PATH

URL=http://www.sophos.com/downloads/ide/ides.zip
SAVBASE="/usr/local/sav"
SAVSHARE="/home/sophos/W95Inst"
SAVTMP=`mktemp -d /tmp/sav-$$-XXXXXX`
echo "Temp Directory: $SAVTMP"
unset DIFFDAT

cd $SAVBASE
mv ides.zip ides.zip.sav

# Detect if the vdl.dat file has been updated.  This is used later
# to determine if the ide files can be deleted or not (in order to
# NOT leave a month hole of recent virii.
DATMD5=`md5sum vdl.dat | cut -d \  -f 1`
if [ "$DATMD5" == "`cat .DATMD5`" ]; then
        echo Same vdl.dat file
else
        echo The vdl.dat file has changed
        echo $DATMD5 > .DATMD5
        DIFFDAT=1
fi

wget $URL
RETVAL=$?

if [ ! "$RETVAL" = "0" ]; then echo "Retrieval of ${URL} failed.  Check
script $0 on `hostname`" # | mail -s "${URL}" [EMAIL PROTECTED]
[EMAIL PROTECTED] 
fi

# Check if new ides.zip is different from saved copy
[ -e ides.zip ] && (
        NEW="`md5sum ides.zip | cut -d \  -f 1`"
        OLD="`md5sum ides.zip.sav | cut -d \  -f 1`"
        if [ "$NEW" != "$OLD" ]; then {
                echo "Newer version detected."
                # Do everything in a temp dir
                cp ides.zip $SAVTMP
                cd $SAVTMP
                unzip -o ides.zip
                # Delete the old IDEs if the vdl.dat has been updated
                if [ $DIFFDAT ]; then
                        rm -f $SAVBASE/*.ide
                        rm -f $SAVSHARE/*.ide
                fi
                # Copy the new IDEs into the /usr/local/sav dir
                cp -f *.ide $SAVBASE
                cp -f *.ide $SAVSHARE
                cd $SAVBASE
                # No need to keep the .sav file, blow it away
                rm -f ides.zip.sav
                icheckd -stop
                sleep 2
                icheckd -force
        } else {
                echo "Same version downloaded.  No need to update."
                if [ $DIFFDAT ]; then
                        echo "New DAT file, extract IDEs manually."
                        cp ides.zip $SAVTMP
                        cd $SAVTMP
                        unzip -o ides.zip
                        rm -f $SAVBASE/*.ide
                        rm -f $SAVSHARE/*.ide
                        # Copy the new IDEs into the /usr/local/sav dir
                        cp -f *.ide $SAVBASE
                        cp -f *.ide $SAVSHARE
                        cd $SAVBASE
                        # No need to keep the .sav file, blow it away
                        rm -f ides.zip.sav
                        icheckd -stop
                        sleep 2
                        icheckd
                fi
        } fi
)

# Fails if file doesn't exist, which means that download didn't succeed.
# Rename saved copy back to original
[ -e ides.zip ] || mv ides.zip.sav ides.zip

# Cleanup
rm -rf $SAVTMP

[EMAIL PROTECTED] ~]# crontab -l | grep get_ides
0 */6 * * * /root/bin/get_ides

Blue skies...                   Todd
- -- 
           MandrakeSoft USA   http://www.mandrakesoft.com
   Easy things should be easy, and hard things should be possible.
                                                --Larry Wall
      Mandrake Cooker Devel Version, Kernel 2.4.21-0.11mdk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+Zj/Ulp7v05cW2woRAu4fAKDEvA+09kQrFrSGZdbWd37YDfpwhACfbnya
4aL3x8RxVhsM8P3InDOlDHA=
=fSOb
-----END PGP SIGNATURE-----

Reply via email to