#!/bin/sh # PATCHMAN v2.2 MPE Patch analysis tool. # -------------------------------------- # Patchman is a patch management tool that analyzes the patches previously # installed on your system, looking for: # # patches that have been marked bad # patches that have been superseded by downloadable patches # patches that have been superseded by non-downloadable patches # patches that are unrecognized (generally alpha or beta patches) # # Patchman then suggests which new patches you might want to download and # install: # # new patches superseding any of your previously installed patches # new patches for FOS or HPSWINFO-patched subsystems # new patches for other subsystems # # Patchman is willing to optionally download and unpack any recommended # patches. # # See patchman -h for full usage information. If run with no parameters, the # default behavior is just to report on installed patches and recommend new # patches. # Download patchman from: # # ftp://ftp.bixby.org/pub/mpe/patchman-2.2.sh # or # http://www.bixby.org/ftp/pub/mpe/patchman-2.2.sh # This piece of personal freeware is unsupported by HP, but I'm willing to # answer comments and questions as time permits: # # email: mark@bixby.org # web : http://www.bixby.org/mark/ # README README README README README README README README README README README # # This tool is not a substitute for exercising your own good judgement or # talking to the HP Response Center!!!!! # # A very small number of people have reported unabortable hung terminal # sessions when running Patchman. This may be due to SR 4701279174. If you # experience this problem, please Please PLEASE open an HPRC call! The more # people who report this, the more likely it is to be fixed. It is an MPE bug, # not a Patchman bug. # # I make some critical assumptions in this script: # # 1) Patch names must match the regexp [A-Z]{2}[0-9A-Z][A-Z]{2}[0-9A-Z]{2}[A-Z] # # 2) A superseding patch will have a name alphanumerically greater than the # superseded patch. # # 3) HPSWINFO is NOT examined chronologically. Thus if you installed a patch, # then supersede it, then at some later date re-install the old version, # this script won't know it and will think you're still using the # superseding patch. # # 4) "Interesting" new non-superseding patches for FOS are identified by a # fixed list of prefixes. I don't know if the prefixes are 100% accurate. # Take a look and let me know. Thanks. # # 5) "Interesting" new non-superseding patches for HPSWINFO are identified by # existing HPSWINFO prefixes. Thus if a new non-FOS subsys patch appears # in the catalog, and you don't already have any patches in HPSWINFO for # this subsys, the new patch won't be listed in the HPSWINFO section (but # it WILL be listed in the other section). # # 6) No attempt is made to analyze dependency information. That's a job for # Patch/iX anyway. (You ARE using Patch/iX, aren't you?) # # README README README README README README README README README README README # CHANGE HISTORY # -------------- # # v2.2 February 1, 2000 # # Added SYL (Syslog/iX) to the list of FOS patch prefixes. # # v2.1 November 18, 1999 # # Uncommented the :ALTSEC @.PATCHXL.SYS;DELACD that had been commented # out in Patchman v2.0. Stage/iX automatically deletes these bogus ACDs, # but if you use Patch/iX to create a tape, the ACDs will be retained and # mess up your system after you update. So Patchman now once again # deletes these ACDs for you. # # v2.0 November 3, 1999 # # De-MOVER-ized to handle the new :STORE-to-disk patch format. # # v1.4 July 9, 1999 # # Modified the code that examines the patch VUF download directory files # (either via ftp ls or the -l option) to expect a list of all files and # then just grep for patch names in order to be compatible with NT ftp # server mirrors that don't appear to support extended ftp ls patterns. # # Exclude RELINKER if it appears in HPSWINFO since it happens to match # patch name syntax but isn't actually a patch. # # v1.3 June 30, 1999 # # Fixed bug where -l option wasn't recognized. # # The full catalog /mpe-ix_patches/catalog is now downloaded instead of # the applicable VUF catalog, and the -c option usage has been changed # to reflect this. # # Check the obsolete patch file for inconsistencies where the superseding # patch is not in the patch catalog. These unavailable superseding # patches are most likely tape-only patches. # # Report on installed patches which are superseded by unavailable # (tape-only) patches. # # v1.2 June 17, 1999 # # Less use of shell functionality that causes fork()ing in order to # avoid the hang described in SR 4701279174. # # Confusing language rewritten to be clearer. # # Added -t option to cache all patch description text files with one # huge FTP download. Gives better performance if you're going to display # many patch descriptions later during the patch selection process. # # -d now checks for the required :HELLO MANAGER.SYS,INSTALL. # # Improved patch selection dialogue. You can now mark individual patches # for download as all three patch classes (superseding, FOS, other) are # listed. A unified, sorted listing of all marked patches is still # presented just prior to starting the actual download, and you can still # accept or reject the list in its entirety or make individual selections. # # Added messages telling you to ignore "Internal error: waitany: unknown # pid xxx" messages which result from a known cosmetic bug (SR 4701250951) # and DO NOT prevent patchman from running properly. # # v1.1 May 25, 1999 # # Perform additional patch server analysis looking for consistency # problems (patches that exist in the catalog but not in the download # directory, and patches that exist in the download directory but not in # the catalog). # # Added the -a parameter to tell patchman to exit after completing the # patch server consistency analysis. # # Added the -l parameter to specify a local HFS override file containing # the list of patch truck files available in the patch server download # directory (instead of doing an FTP directory listing). # # After all patches have been unpacked, scan the remark files looking # for patches that have been marked bad or suffer from MOVER635 # corruption. # # v1.0 May 11, 1999 # # Initial public release. # # User configuration items. Modify as appropriate. # # The temporary file name prefix, i.e. $TEMP.foobar export TEMP=/tmp/patchman.$$ # Where the patches will be downloaded to. DOWNLOADDIR=/SYS/INSTALL # # NO USER SERVICEABLE PARTS BELOW! # # Internal configuration items. VERSION="PATCHMAN v2.2" typeset -l NODE VUF NODE=$(uname -n) # Change V.UU.FF to v.uu.00 export VUF=$(uname -r | sed -e 's/ \([A-Z]\.[0-9]\{2\}\)\.[0-9]\{2\}/\1.00/') HEADING="$VERSION [$HPRELVERSION $NODE $HPCPUNAME] $(/bin/date)" # The HP patch ftp site. PATCHHOST=ftp.itrc.hp.com PATCHUSER=anonymous PATCHPASS=$HPUSER.$HPACCOUNT@$NODE.mpe UNPACKPPATH=/export/bin/unpackp UNPACKPDIR=/SYS/PATCHXL OBSOLETEPATH=/export/patches/mpe-ix_obs_patch_list PATCHDIR=/mpe-ix_patches/$VUF CATALOGPATH=/mpe-ix_patches/catalog # Parameter defaults. CACHE= CATALOG= DFLT1=N DFLT2=Y DIRLIST= EMAIL= FTPCLIENT=/SYS/ARPA/FTP MODE=report OBSOLETE= PROXY= PROXYHOST= PROXYPASS= PROXYUSER= UNPACKP= # Patch prefixes considered to be part of FOS. FOS="ATC BBR BWR DCC DLP DTC DTR DTS FTP FWS INT LAN LBC LNK LSS MPE \ NMC NMS NRC NST ODI ODU OFD OSP PTD PX2 QUE RPR SMB STR SYL TIX TRR VPL" # Function definitions. # # usage - print usage information # function usage { /bin/cat >&2 <&2 exit 666 fi echo callci "print $TEMP.cache/$1.txt" echo else echo 'Getting patch details...please wait...' rm -f $TEMP.$1.txt $TEMP.ftpok echo exitonerror >$TEMP.cmd ftpopen $PATCHHOST $PATCHUSER $PATCHPASS >>$TEMP.cmd /bin/cat - <>$TEMP.cmd byte get $PATCHDIR/$1.txt $TEMP.$1.txt close :/SYS/HPBIN/TOUCH $TEMP.ftpok EOF callci "print $TEMP.cmd;out=\$newpass" callci "xeq $FTPCLIENT <\$oldpass >$TEMP.ftp" if [ ! -f $TEMP.ftpok ]; then echo "Fatal error: Download of $1 patch details failed!\n" >&2 /bin/cat $TEMP.ftp >&2 exit 666 fi echo callci "print $TEMP.$1.txt" echo callci 'purge $oldpass' rm -f $TEMP.$1.txt $TEMP.cmd $TEMP.ftp $TEMP.ftpok fi fi done if [ "$RCANS" = "Y" ]; then echo "$1" >>$OUTCAN SIZE=$(expr "$QUESTION" : '[A-Z0-9]* *\([0-9]*\) .*') SUBTOTAL=$((SUBTOTAL+SIZE)) fi } # # selectpatches # function selectpatches { INCAT=$1 OUTCAN=$2 echo "Patch Sectors Description" echo "-------- ------- --------------------------------------------------------\ ---" awk '\ BEGIN { TOTAL=0 } { TOTAL=TOTAL+$2; sub($2,sprintf("%7d",$2)); print $0 } END { printf " -------\nTOTAL:%10d\n",TOTAL; print TOTAL >ENVIRON["TEMP"] ".total" } ' $INCAT if [ "$MODE" = "download" ]; then echo readchar \ "Mark all(Y), none(N), or select(S) individual patches for download?" \ $DFLT1 $DFLT2 S if [ "$RCANS" = "Y" ]; then awk ' { print $1 }' $INCAT >>$OUTCAN SUBTOTAL=$(<$TEMP.total) TOTAL=$((TOTAL+SUBTOTAL)) elif [ "$RCANS" = "S" ]; then echo "\nPlease select which individual patches you want to download; enter" echo 'Y to mark the patch for download, N to skip the patch, D to see patch' echo "details:\n" rm -f $TEMP.can.sel awk ' {printf "selectpatch %s\n",$1}' $INCAT >$TEMP.can.sel # Invoke selectpatch for each candidate. echo "Patch Sectors Description" echo "-------- ------- --------------------------------------------------" SUBTOTAL=0 . $TEMP.can.sel TOTAL=$((TOTAL+SUBTOTAL)) fi fi } # # MAIN BODY # # Parse the parameters. if [ $# -gt 0 ]; then while getopts :ac:de:f:hl:m:no:p:rtu:y OPT; do case $OPT in a) MODE=analyze ;; c) CATALOG=$(hfsfile "$OPTARG"); if [ ! -s $CATALOG ]; then echo "The local patch catalog file $CATALOG does not exist!" >&2 exit 666 fi ;; d) MODE=download; if [ "$HPUSER" != "MANAGER" -o "$HPACCOUNT" != "SYS" -o \ "$HPGROUP" != "INSTALL" -o "$HPCWD" != "/SYS/INSTALL" ]; then echo "-d (downloading requires) :HELLO MANAGER.SYS,INSTALL" >&2 exit 666 fi ;; e) EMAIL="$OPTARG" ;; f) FTPCLIENT=$(hfsfile "$OPTARG"); if [ ! -x $FTPCLIENT ]; then echo "The local FTP client program $FTPCLIENT is not executable!" >&2 exit 666 fi ;; h) usage; exit 0;; l) DIRLIST=$(hfsfile "$OPTARG"); if [ ! -s $DIRLIST ]; then echo "The local patch dirlist file $DIRLIST does not exist!" >&2 exit 666 fi ;; n) DFLT1=N; DFLT2=Y ;; o) OBSOLETE=$(hfsfile "$OPTARG"); if [ ! -s $OBSOLETE ]; then echo "The local obsolete patch file $OBSOLETE does not exist!" >&2 exit 666 fi ;; p) PROXY="$OPTARG"; PROXYUSER=$(echo "$PROXY" | sed -e 's/\(\(.*\):.*@\)*.*/\2/'); PROXYPASS=$(echo "$PROXY" | sed -e 's/\(.*:\(.*\)@\)*.*/\2/'); PROXYHOST=$(echo "$PROXY" | sed -e 's/\(.*:.*@\)*\(.*\)/\2/'); ;; r) MODE=display ;; t) CACHE=Y ;; u) UNPACKP=$(hfsfile "$OPTARG"); if [ ! -x $UNPACKP ]; then echo "The local UNPACKP script $UNPACKP is not executable!" >&2 exit 666 fi ;; y) DFLT1=Y; DFLT2=N ;; ?) echo "Invalid option: $OPTARG" >&2; usage; exit 666 ;; esac done if [ $OPTIND -le $# ]; then shift $OPTIND-1 echo "Unrecognized parameters: $@" >&2 usage exit 666 fi fi # [ $# -gt 0 ] echo "$HEADING\n" rm -f $TEMP.* if [ "$MODE" = "download" ]; then rm -f $TEMP.can.raw touch $TEMP.can.raw TOTAL=0 fi if [ -z "$OBSOLETE" -o -z "$CATALOG" -o -z "$DIRLIST" -o "$CACHE" = "Y" ]; then # Generate the FTP commands needed to download the obsolete patch list, # the current patch catalog, and the patch directory listing. rm -f $TEMP.ftpok echo exitonerror >$TEMP.cmd ftpopen $PATCHHOST $PATCHUSER $PATCHPASS >>$TEMP.cmd echo "hash\nbyte" >>$TEMP.cmd if [ -z "$OBSOLETE" ]; then echo "get $OBSOLETEPATH $TEMP.sup.raw" >>$TEMP.cmd OBSOLETE="$TEMP.sup.raw" fi if [ -z "$CATALOG" ]; then echo "get $CATALOGPATH $TEMP.cat.raw" >>$TEMP.cmd CATALOG="$TEMP.cat.raw" fi if [ -z "$DIRLIST" ]; then echo "cd $PATCHDIR\nls . $TEMP.dir.raw" >>$TEMP.cmd DIRLIST="$TEMP.dir.raw" fi if [ "$CACHE" = "Y" ]; then mkdir $TEMP.cache echo "lcd $TEMP.cache\nprompt off\nmget ./[A-Z]*[A-Z].txt" >>$TEMP.cmd fi echo "close\n:/SYS/HPBIN/TOUCH $TEMP.ftpok\nexit" >>$TEMP.cmd echo "Downloading the obsolete patch list and the current patch catalog...\n" callci "print $TEMP.cmd;out=\$newpass" callci "xeq $FTPCLIENT <\$oldpass" if [ ! -f $TEMP.ftpok ]; then echo "\nFatal error: Download failed!" >&2 exit 666 fi callci 'purge $oldpass' rm -f $TEMP.ftpok $TEMP.cmd echo "\nDownload completed!\n" fi # [ -z "$OBSOLETE" -o -z "$CATALOG" ] if [ ! -s $OBSOLETE ]; then echo "Fatal error: The obsolete list file $OBSOLETE is missing!" >&2 exit 666 fi if [ ! -s $CATALOG ]; then echo "Fatal error: The patch catalog file $CATALOG is missing!" >&2 exit 666 fi if [ ! -s $DIRLIST ]; then echo "Fatal error: The patch dirlist file $DIRLIST is missing!" >&2 exit 666 fi grep '^[A-Z]\{2\}[0-9A-Z][A-Z]\{2\}[0-9A-Z]\{2\}[A-Z]$' $DIRLIST |\ sort >$TEMP.dir echo "Generating the local installed patch list from HPSWINFO...\c" # Extract just the lines that start with patch names. awk '\ /^[A-Z]{2}[0-9A-Z][A-Z]{2}[0-9A-Z]{2}[A-Z] / && ! /^RELINKER/ { print $1 }' \ /SYS/PUB/HPSWINFO | sort | uniq >$TEMP.ins echo "done!\nGenerating the MPE VUF current patch catalog...\c" # Convert multi-line format of all VUFs into single-line format of our VUF. awk '\ BEGIN { VUF=ENVIRON["VUF"] } /^Patch Name: / { if (match($0,VUF) == 0) { OK=0 } else { OK=1; NAME=substr($0,length($0)-7) }; next } /^ Description: / { DESC=substr($0,17); next } /^ Patch Size : / { if (OK==1) printf "%s %s %s\n",NAME,$4,DESC }' \ $CATALOG | sort >$TEMP.cat.tmp # Create a subset containing just the bad patches. grep 'HAS BEEN MARKED BAD' $TEMP.cat.tmp >$TEMP.cat.bad # If a patch exists in the catalog, but not as an actual patch file in the # directory, then remove it from the catalog. join -v 1 $TEMP.cat.tmp $TEMP.dir >$TEMP.cat.nodir if [ -s $TEMP.cat.nodir ]; then join $TEMP.cat.tmp $TEMP.dir >$TEMP.cat else mv -f $TEMP.cat.tmp $TEMP.cat fi # Do any patches exist as patch files in the directory but not in the catalog? join -v 1 $TEMP.dir $TEMP.cat >$TEMP.dir.nocat echo "done!\nGenerating the MPE VUF obsolete patch list...\c" # Since the obsolete patch list spans all VUFs, trim it back to only include # superseding patches in the VUF catalog. awk '\ /^[0-9]*[A-Z]{2}[0-9A-Z][A-Z]{2}[0-9A-Z]{2}[A-Z] / \ { sub(/[0-9]*/,"",$1); printf "%s %s\n",$2,$1 }' $OBSOLETE | sort |\ tee $TEMP.sup.all | join -o '1.2 1.1' - $TEMP.cat | sort >$TEMP.sup echo "done!\nGenerating the local superseded patch list...\c" rm -f $TEMP.sup.new $TEMP.sup.old touch $TEMP.sup.new $TEMP.sup.old # Which installed patches have supersedes? # Remove the supersedes that are already installed. Split the list into a # file of old installed patches and another file of new available supersedes. join $TEMP.ins $TEMP.sup | sort -k 2.0 -k 1.0r | uniq -f 1 | join -v 1 -1 2 - $TEMP.ins |\ awk '\ BEGIN { TEMP=ENVIRON["TEMP"]; NEW=TEMP ".sup.new"; OLD=TEMP ".sup.old" } { print $1 >>NEW; print $2 >>OLD }' echo "done!\nChecking for HP patch server inconsistencies...\c" grep "^Patch Name: /mpe-ix_patches/" $CATALOG |\ sed -e 's/.*\(........\)$/\1/' | sort >$TEMP.cat.all join -v 1 $TEMP.sup.all $TEMP.cat.all >$TEMP.sup.nocat if [ -s $TEMP.cat.nodir -o -s $TEMP.dir.nocat -o -s $TEMP.sup.nocat ]; then echo if [ -s $TEMP.cat.nodir ]; then /bin/cat - < PATCHES ALREADY INSTALLED (LISTED IN /SYS/PUB/HPSWINFO)\n" echo 'The following installed patches have been marked bad. If a superseding' echo "patch is available, it will be listed in the superseding report:\n" # Generate installed bad patches and their corresponding superseding patches # if any. Complain about the bad patches that haven't had superseding fixes # installed. join -o 1.1 $TEMP.ins $TEMP.cat.bad |\ join - $TEMP.sup | sort -k 2.0 -k 1.0r | uniq -f 1 |\ join -v 1 -1 2 - $TEMP.ins | awk ' { printf "^%s\n",$2 }' >$TEMP.bad if [ -s $TEMP.bad ]; then echo "Patch Description" echo "-------- -------------------------------------------------------------\ --------" grep -E -f $TEMP.bad /SYS/PUB/HPSWINFO | sort else echo NONE fi echo "\nThe following installed patches have been superseded:\n" if [ -s $TEMP.sup.old ]; then echo "Patch Description" echo "-------- -------------------------------------------------------------\ --------" awk ' { printf "^%s\n",$1}' $TEMP.sup.old >$TEMP.pat grep -E -f $TEMP.pat /SYS/PUB/HPSWINFO | sort rm -f $TEMP.pat else echo NONE fi echo "\nThe following installed patches have been superseded by patches which" echo "are unavailable for download (you will have to ask the HPRC to send you" echo "these unavailable patches on tape):\n" sort -k2 $TEMP.sup.nocat | join -1 2 - $TEMP.ins >$TEMP.sup.unavail if [ -s $TEMP.sup.unavail ]; then echo "Installed Unavail Installed Patch Description" echo "--------- -------- ---------------------------------------------------\ --------" grep -v '^ ' /SYS/PUB/HPSWINFO | sort | join - $TEMP.sup.unavail |\ awk '{ printf "%s %s %.59s\n",$1,$NF,substr($0,10,length($0)-18) }' else echo NONE fi echo "\nThe following installed patches are unrecognized, because they were" echo 'either alpha, beta, or omitted from the MPE VUF catalog for some weird' echo "reason:\n" # Installed patches not in the catalog and not superseded by normal or # unavailable patches. join -v 1 $TEMP.ins $TEMP.cat |\ join -v 1 - $TEMP.sup |\ join -v 1 - $TEMP.sup.unavail >$TEMP.unk.tmp if [ -s $TEMP.unk.tmp ]; then echo "Patch Description" echo "-------- -------------------------------------------------------------\ --------" awk ' { printf "^%s\n",$1}' $TEMP.unk.tmp >$TEMP.pat grep -E -f $TEMP.pat /SYS/PUB/HPSWINFO | sort rm -f $TEMP.pat else echo NONE fi echo "\n==========> PATCHES YOU MIGHT WANT TO INSTALL FROM ftp://$PATCHHOST\n" echo "The following new superseding patches are available for download:\n" if [ -s $TEMP.sup.new ]; then join $TEMP.sup.new $TEMP.cat >$TEMP.sup.new.cat selectpatches $TEMP.sup.new.cat $TEMP.can.raw else echo NONE fi echo \ "\nThe following new FOS/HPSWINFO-based patches are available for download:\n" # Generate a list of "interesting" patch prefixes based on standard FOS items # and patches in HPSWINFO. echo $FOS | sed -e 's/ /\ /g' | awk ' { printf "^%s\n",substr($1,1,3) }' - $TEMP.ins |\ sort | uniq >$TEMP.pat # Generate catalog patches that haven't been installed and aren't bad. # Remove the recommended superseding patches. join -v 2 $TEMP.ins $TEMP.cat | grep -v 'HAS BEEN MARKED BAD' |\ join -v 1 - $TEMP.sup.new >$TEMP.fos.tmp2 # Only report on patches with the "interesting" prefixes. grep -f $TEMP.pat $TEMP.fos.tmp2 >$TEMP.fos.tmp if [ -s $TEMP.fos.tmp ]; then selectpatches $TEMP.fos.tmp $TEMP.can.raw else echo NONE fi echo "\nThe following new other patches are available for download:\n" grep -v -f $TEMP.pat $TEMP.fos.tmp2 >$TEMP.fos.tmp if [ -s $TEMP.fos.tmp ]; then selectpatches $TEMP.fos.tmp $TEMP.can.raw else echo NONE fi fi # [ "$MODE" != "analyze" ] ############################################################################### if [ "$MODE" = "download" ]; then echo "\n==========> DOWNLOADING PATCHES FROM ftp://$PATCHHOST$PATCHDIR/\n" if [ -s $TEMP.can.raw ]; then echo "The following patches are download candidates:\n" sort $TEMP.can.raw | uniq | join - $TEMP.cat >$TEMP.can.cat rm -f $TEMP.can touch $TEMP.can TOTAL=0 selectpatches $TEMP.can.cat $TEMP.can echo if [ $TOTAL -ne 0 ]; then # VSN=$(echo $(callci "echo ![finfo('$DOWNLOADDIR','volume set name')]")) # FREE=$(expr "$(echo $(/SYS/PUB/DISCFREE "D,,$VSN"))" : '.* \([0-9]*\)') # Go to heroic lengths to avoid a fork() in this part of the code in order # to avoid the SR 4701279174 hang problem. callci "echo ![finfo('$DOWNLOADDIR','volume set name')]" >$TEMP.nofork read VSN <$TEMP.nofork echo $VSN >$TEMP.nofork read VSN <$TEMP.nofork callci xeq /SYS/PUB/DISCFREE \"D,,$VSN\" >$TEMP.nofork while read junk; do case "$junk" in *AVAIL\ TO\ PERM\ SPACE*) set -A DISCFREE $junk FREE=${DISCFREE[$((${#DISCFREE[*]}-1))]} ;; esac done <$TEMP.nofork echo "$TOTAL sectors of patches have been selected for download;" echo "$FREE sectors of free space are available on $VSN.\n" readchar "Start the download?" $DFLT1 $DFLT2 echo if [ "$RCANS" = "N" ]; then rm -f $TEMP.can fi fi # [ $TOTAL -ne 0 ] fi # [ -s $TEMP.can.raw ] if [ -s $TEMP.can ]; then echo "Downloading the patch utilities and the selected patches...\n" # Generate the FTP commands needed to download the patch utilities and the # patches themselves. rm -f $TEMP.unpackp while read PATCH; do rm -f $DOWNLOADDIR/$PATCH done <$TEMP.can rm -f $TEMP.ftpok echo exitonerror >$TEMP.cmd ftpopen $PATCHHOST $PATCHUSER $PATCHPASS >>$TEMP.cmd echo "hash\nbyte" >>$TEMP.cmd if [ -z "$UNPACKP" ]; then echo "get $UNPACKPPATH $TEMP.unpackp.raw" >>$TEMP.cmd UNPACKP="$TEMP.unpackp.raw" fi while read PATCH; do echo "get $PATCHDIR/$PATCH $DOWNLOADDIR/$PATCH;disc=2147483647" done <$TEMP.can >>$TEMP.cmd echo "close\n:/SYS/HPBIN/TOUCH $TEMP.ftpok\nexit" >>$TEMP.cmd callci "print $TEMP.cmd;out=\$newpass" callci "xeq $FTPCLIENT <\$oldpass" if [ ! -f $TEMP.ftpok ]; then echo 'Fatal error: Download failed!' >&2 exit 666 fi callci 'purge $oldpass' rm -f $TEMP.cmd $TEMP.ftpok while read PATCH; do if [ ! -s $DOWNLOADDIR/$PATCH ]; then echo "Fatal error: The patch file $DOWNLOADDIR/$PATCH is missing!" >&2 exit 666 fi done <$TEMP.can echo "\nDownload completed!\n\nPreparing utilities for execution...\c" if [ ! -s $UNPACKP ]; then echo "Fatal error: The unpackp script $UNPACKP is missing!" >&2 exit 666 fi # Make sure the utilities are executable. cp $UNPACKP $TEMP.unpackp chmod 700 $TEMP.unpackp echo "done!\n\nUnpacking all downloaded patches...\n" # Unpack the patches. /bin/cat - <&2 exit 666 fi rm -f $DOWNLOADDIR/$PATCH done <$TEMP.can echo "\nUnpacking completed!\n" /bin/cat - <$TEMP.pat rm -f $TEMP.veto while read PATCH; do SUFFIX=`expr $PATCH : '...\(.....\)'` rm -f $TEMP.hits grep -F -f $TEMP.pat $UNPACKPDIR/RM$SUFFIX >$TEMP.hits if [ -s $TEMP.hits ]; then echo $PATCH >>$TEMP.veto fi done <$TEMP.can if [ -s $TEMP.veto ]; then /bin/cat - <