#!/bin/sh
#
# ident "@(#)prepatch	1.5 02/07/10 SMI"
#
# Copyright (c) 2002 Sun Microsystems, Inc.
# All rights reserved.
#
# If S8 is installed, the following patches must be installed:
# 
#	108919-14 CDE Patch
#	109354-14 CDE Patch
#
# The version above is the minimum version which must be installed

retval=0

if [ `uname -r` = "5.8" ]
then

   # REQPATCH1 checks the minimum revision of 108919
   REQPATCH1=`showrev -p | sed -n 's/Patch: 108919-\([^ ]*\).*/\1/p' \
	| sort -n | tail -1`
  
   # REQPATCH2 checks the minimum revision of 109354
   REQPATCH2=`showrev -p | sed -n 's/Patch: 109354-\([^ ]*\).*/\1/p' \
	| sort -n | tail -1`


   # Check the installed version against the minimum version
   if [ x"$REQPATCH1" = "x" ] || [ $REQPATCH1 -lt 14 ]
   then
       echo "You must install patch 108919-14 or later before proceeding"
       # force the patchadd to fail
       retval=1
   fi

   if [ x"$REQPATCH2" = "x" ] || [ $REQPATCH2 -lt 14 ]
   then
       echo "You must install patch 109354-14 or later before proceeding"
       # force the patchadd to fail
       retval=1
   fi

fi

exit $retval
