#!/bin/ksh # This program gets the Solaris patch report and determines # what patches are missing from the system through calling # the patchcheck.pl program. # Establish environment. FTPPASS is the e-mail address of the # local system administrators , in case Sun needs to contact them . # # Myloc: where patchcheck and patchcheck.pl are installed. MYLOC=/usr/local/cron # ftppass: e-mail address to be used by anonymous FTP FTPPASS=jeffreyb@sungames.com # Recipient: who gets the e-mailed copy of the report from the program. RECIPIENT=$FTPPASS # Myperl: where perl is installed. MYPERL=/usr/local/bin/perl # Mydir - directory to use for this program's temporary files. MYDIR=/ cd $MYDIR # Discover version of Solaris and CPU type. VERSION=$(uname -a | awk '{print $3}') CPUTYPE=$(uname -a | awk '{print $6}') if [[ $VERSION = 5.4 ]] then SOLVERSION="2.4" elif [[ $VERSION = 5.5 ]] then SOLVERSION="2.5" elif [[ $VERSION = 5.5.1 ]] then SOLVERSION="2.5.1" elif [[ $VERSION = 5.6 ]] then SOLVERSION="2.6" elif [[ $VERSION = 5.7 ]] then SOLVERSION="7" elif [[ $VERSION = 5.8 ]] then SOLVERSION="8" elif [[ $VERSION = 5.9 ]] then SOLVERSION="9" fi if [[ $CPUTYPE = sparc ]] then PATCHREPORT="Solaris$SOLVERSION.PatchReport" else PATCHREPORT="Solaris$SOLVERSION._x86.PatchReport" fi ## Fetch listing of patches from Sun... ftp -n sunsolve.sun.com << EOF user anonymous $FTPPASS cd pub cd patches bin get $PATCHREPORT EOF ## Get list of locally installed patches. showrev -p | awk '{ print $2}' > $MYDIR/patch_file.txt $MYPERL $MYLOC/patchcheck.pl -p $MYDIR/patch_file.txt $MYDIR/$PATCHREPORT > $MYDIR/Full_Report_Differential.$$ /bin/mail $RECIPIENT < $MYDIR/Full_Report_Differential.$$ /bin/rm $MYDIR/$PATCHREPORT /bin/rm $MYDIR/patch_file.txt /bin/rm $MYDIR/Full_Report_Differential.$$