#!/bin/ksh -p # script to update patches on a machine. See usage() below # Written by Philip Brown patchdir=`dirname $0` cd $patchdir usage() { print "usage: patchupdate [-R /root/dir]" print "patchupdate uses patchcompare to figure out what patches are downrev," print " and will then install them, using the patch_order file in the directory" } if [[ "$1" = "-h" ]] ; then usage exit fi if [[ "$1" = "-R" ]] ; then ROOTARGS="$1 $2" shift shift fi if [[ ! -f patch_order ]] ; then print ERROR: need a patch_order file exit 1 fi ###################################################################### # End of prep work. real stuff starts here TMPFILE=/tmp/patchupdate.$$ rm $TMPFILE; touch $TMPFILE ./patchcompare $ROOTARGS -l |awk -F: >$TMPFILE count=`wc -w $TMPFILE` if [[ ! -s $TMPFILE ]] ; then print No patches to add rm $TMPFILE exit 0 else print Attempting to apply $count patches fi patchadd $ROOTARGS -M . `fgrep -f $TMPFILE patch_order` rm $TMPFILE