#!/sbin/sh

########
#  Product: GraphicsPEX5DK
#  Fileset: PEX5-EXAMPLES
#  preinstall
#  @(#) $Revision: 550.2 $
########
#
# (c) Copyright Hewlett-Packard Company, 1996
#
########

	UTILS="/usr/lbin/sw/control_utils"

	if [[ ! -f $UTILS ]]
	then
		echo "ERROR: Cannot find $UTILS"
		exit 1
	fi

	. $UTILS

	exitval=$SUCCESS

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

	##
	## Set up local environment variables
	##

	SW_INSTALL_DIR="/"

	##
	## Test to see if either SW_ROOT_DIRECTORY or SW_LOCATION is
	## set to something other than /.  If so, set up SW_INSTALL_DIR
	## so it will not have spurious /'s in the path name.
	##

	if [ $SW_ROOT_DIRECTORY != / -o $SW_LOCATION != / ]
	then
		if [ $SW_ROOT_DIRECTORY != / ]
		then
			if [ $SW_LOCATION != / ]
			then
				SW_INSTALL_DIR="${SW_ROOT_DIRECTORY}${SW_LOCATION}"
			else
				SW_INSTALL_DIR="${SW_ROOT_DIRECTORY}"
			fi
		else
			if [ $SW_LOCATION != / ]
			then
				SW_INSTALL_DIR="${SW_LOCATION}"
			fi
		fi
	fi

	VAR_OPT_DIR="${SW_ROOT_DIRECTORY}var/opt/PEX5"

	##
	## Protect pexut.a and associated objects.
	##

	FILE_LIST="\
		pexut.a		\
		book_utils.o	\
		pexutcmap.o	\
		pexutcmaphp.o	\
		pexutcmapint.o	\
		pexutdb.o	\
		pexutdbint.o	\
		"

	for PREP_FILE in $FILE_LIST
	do
		PREP_TARGET=${VAR_OPT_DIR}/${PREP_FILE}

		if [ -f $PREP_TARGET ]
		then
			newconfig_prep $PREP_TARGET
		fi
	done

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