#!/sbin/sh

########
# Product:  GraphicsSBaseDK
# Fileset:  STAR-MAN
# configure
#
# $Source: /hmstmp/update.25011/./release/SD/GraphicsSBase/STAR-MAN/configure,v $
# $Revision: 550.2 $
# $Date: 96/07/16 11:10:14 $
#
########
#
# (c) Copyright Hewlett-Packard Company 1994
#
########

	set -a       					# export all vars
	exitval=0					# anticipate success

	UTILS="/usr/lbin/sw/control_utils"
	if [[ ! -f $UTILS ]]
	then
		echo "ERROR:    Cannot find UTILS"
		exit 1
	fi
	. $UTILS

################################################################################
#set -x # For debugging purposes.  _Never_ ship uncommented!!


	##
	## Add names of cat files to IPD list so swremove gets them all if
	## used after catman or man creates files in the cat* directories:
	##
	TEMP_ID=$$
	TMP_DIR=/var/tmp
	LIST_FILE=$TMP_DIR/swlist.$TEMP_ID
	TMP_FILE=$TMP_DIR/tmp.$TEMP_ID
	
	##
	## Copy the FAFM-MAN IPD file list with link names to temporary
	## file.  The Product, Subproduct and Fileset names
	## must adhere to the following syntax:
	##
	##    product[.subproduct][.fileset]
	##
	swlist -l file "GraphicsSBaseDK.Manuals.STAR-MAN" 2>&1 | \
		grep "/" | \
		sed -e "s/[ 	][ 	]*//g" | \
		egrep "^\/" | \
		grep "\/usr\/share\/man\/" > $LIST_FILE 
	
	##
	## Change man?.Z and man1m.Z to cat?.Z and cat1m.Z in file list.
	## Put result in temporary file, then add the new names to the
	## IPD for the FAFM-MAN fileset
	##
	
	sed			\
	    -e 's/man1.Z/cat1.Z/g'	\
	    -e 's/man1m.Z/cat1m.Z/g'	\
	    -e 's/man2.Z/cat2.Z/g'	\
	    -e 's/man3.Z/cat3.Z/g'	\
	    -e 's/man4.Z/cat4.Z/g'	\
	    -e 's/man5.Z/cat5.Z/g'	\
	    -e 's/man7.Z/cat7.Z/g'	\
	    $LIST_FILE > $TMP_FILE
	
	##
	## Add all of the new "cat" file names to the IPD
	##
	for FILE in `cat $TMP_FILE`
	do
		IPD_addfile $FILE
	done
	
	##
	## Use the temporary file to clean out any existing "cat"
	## entries so new ones will be created.
	##
	for FILE in `cat $TMP_FILE`
	do
		rm -f $FILE 2>&1 > /dev/null
	done

	##
	## Clean up temporary files
	##
	rm -f $LIST_FILE $TMP_FILE 2>&1 > /dev/null

	exit $exitval
################################################################################
