#!/sbin/sh

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

	EXT_DIR="${SW_ROOT_DIRECTORY}usr/lib/X11/extensions"
	XERRORDB="${EXT_DIR}/XErrorDB"
	PEX_FONT_PATH="${EXT_DIR}/fp.PEX"
	##PEX_RELNOTES="${SW_LOCATION}10.0_Rel_Notes"

	##
	## Take care of the XErrorDB, fp.PEX and ReleaseNotes
	## via the newconfig_prep routine in
	## /usr/lbin/sw/control_utils
	##
	newconfig_prep ${XERRORDB}
	newconfig_prep ${PEX_FONT_PATH}
	##newconfig_prep ${PEX_RELNOTES}

	##
	## Rename the /opt/graphics/PEX5/help5.1v2 and/or
	## /opt/graphics/PEX5/help5.1v3 to /opt/graphics/PEX5/help
	## so the old name will "go away" and the new files will
	## be installed at the new location.
	##
	mv ${SW_INSTALL_DIR}help5.1v2 ${SW_INSTALL_DIR}help > /dev/null 2>&1
	mv ${SW_INSTALL_DIR}help5.1v3 ${SW_INSTALL_DIR}help > /dev/null 2>&1

        PEX_DIR="/usr/vue/icons"
        if [[ -d $PEX_DIR ]]
           then
             chmog 555 bin bin $PEX_DIR > /dev/null 2>&1
        fi

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