#!/sbin/sh

########
# Product:  GraphicsPEX5RT
# Fileset:  PEX5-RUN
# configure
#
# $Source: /hmstmp/update.22059/./release/SD/GraphicsPEX5v2/PEX5-RUN/configure,v $
# $Revision: 550.2 $
# $Date: 96/07/16 12:22:40 $
#
########
#
# (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!!


	##
	##  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

	PEX_DIR="$SW_INSTALL-DIR"
	PEX_LIB_DIR="${PEX_DIR}lib"
	PEX_FONT_DIR="${SW_LOCATION}fonts"

	ETC_PEX_DIR="${SW_ROOT_DIRECTORY}etc/opt/PEX5"
	ETC_FONT_LINK="${ETC_PEX_DIR}/fonts"

	##
	## Test to see if /etc/opt/PEX5 already exists.  If not,
	## create it and then create the fonts symbolic link in
	## the new directory.
	##

	if [ ! -d ${ETC_PEX_DIR} ]
	then
		mkdir -p  $ETC_PEX_DIR > /dev/null 2>&1
		chmod 555 $ETC_PEX_DIR > /dev/null 2>&1
		chgrp bin $ETC_PEX_DIR > /dev/null 2>&1
		chown bin $ETC_PEX_DIR > /dev/null 2>&1
	fi

	##
	## Test to see if the fonts link already exists.  If not,
	## create the link.
	##

	if [ ! -h $ETC_FONT_LINK -a	\
	     ! -d $ETC_FONT_LINK -a	\
	     ! -f $ETC_FONT_LINK ]
	then
		ln -s $PEX_FONT_DIR $ETC_FONT_LINK > /dev/null 2>&1
	fi

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