#!/bin/sh #+ # NAME: # sophos_init # PURPOSE: # Install Sophos # CALLING SEQUENCE: # sophos_init # RESTRICTIONS: # The cronjob set up to run sophos_sweep assumes than # cass247.ucsd.edu is the Sophos server, and that # .netrc contains the username and password needed to # mount the SMB mount. # PROCEDURE: # Needs Sophos tarball in working directory. # MODIFICATION HISTORY: # NOV-2005, Paul Hick (UCSD/CASS) #- MYNAME=$(basename $0) echo_msg() { echo $MYNAME, $* return } if [ "$USER" != "root" ]; then echo_msg "run from root account only. Aborting !!!" exit 0 fi if [ -z "$1" ]; then echo_msg "specify full path to Sophos .tar.Z file" exit 0 fi if [ ! -f "$1" ]; then echo_msg "$1 does not exist. Abort !!!" exit 0 fi # Unpack tarball tar xvzf $1 if [ $? != 0 ]; then echo_msg "failed untar of $1" rm -rf sav-install exit 0 fi echo echo_msg "running install script in ./sav-install" echo cd sav-install ./install.sh cd .. echo echo_msg "removing ./sav-install" rm -rf sav-install echo echo Verify installation. echo #for f in sweep sophos_sweep sophos_update smbmount; do for f in sweep sophos_sweep sophos_update mount.cifs; do if [ -n "$(which $f)" ]; then echo_msg "$f is present" else echo_msg "ERROR. $f not found !!!" fi done # Create the configuration file /etc/eminstall.conf if [ ! -f /etc/eminstall.conf ]; then if [ -f /etc/sav.conf ]; then SAV_DIR="$(cat /etc/sav.conf | grep "SAV virus data directory" | gawk '{print $6}')" touch /etc/eminstall.conf echo "EM install CID = /media/sophos_server/unixinst/linux/intel_libc6_glib2_2" >> /etc/eminstall.conf echo "EM cache dir = $SAV_DIR" >> /etc/eminstall.conf echo "protocol = smbfs" >> /etc/eminstall.conf fi fi for f in /etc/sav.conf /usr/local/sav/eminstall.sh /etc/eminstall.conf; do if [ -f $f ]; then echo_msg "$f is present" else echo_msg "ERROR. $f not found !!!" fi done grep sophos_sweep /var/spool/cron/$USER if [ $? == 0 ]; then echo "sophos_sweep already set up in crontab" else echo "00 23 * * 6 sophos_sweep $USER cass247.ucsd.edu 2>&1 I mail -s 'Sophos sweep' $USER" >> /var/spool/cron/$USER fi echo echo Current crontab for $USER is: echo crontab -l exit 0