#!/bin/sh

#
#    update_pdtok infile 
#
#	update_pdtok is used to update products ok files and all the package
#	ok files which listed in products ok file
#	
#############################################################################
#############################################################################
#
#	Copyright (C) Cadence Design Systems, Inc. All rights
#	reserved.  Unpublished -- rights reserved under the
#	copyright laws of the United States of America.
#
#			RESTRICTED RIGHTS LEGEND
#	Use, duplication, or disclosure by the Government is subject
#	to restrictions as set forth in subparagraph (c)(l)(ii) of 
#	the Rights in Technical Data and Computer Software clause 
#	at DFARS 52.227-7013.
#
#			Cadence Design Systems, Inc.
#			555 River Oaks Parkway
#			San Jose, CA 95134	USA
#
#############################################################################

test -z "$Rm" && Rm=/bin/rm;            export Rm

if [ -z "$Proot" ]; then  
    echo "$0 environment not initialized" 				1>&2
    exit 1 
fi
export Proot

pdts=$Proot/install/pdts

infile=$1 ; shift

while read pkgdesc pkgname reminder ; do
	files=`/bin/ls ${pdts}/*.ok  2> /dev/null`
	test -z "$files" || {
          for file in $files ; do
            fileRoot=`expr $file : '\(.*\)\.ok'`
            grep -i "$pkgname " $file > /dev/null
            test $? -eq 0 && mv ${fileRoot}.ok ${fileRoot}.nok
          done
	}
done < $infile
exit 0
