#!/sbin/sh

########
# Product:  GraphicsSBaseDK
# Fileset:  SBDL-MAN
# postinstall
#
# $Source: /hmstmp/update.25011/./release/SD/GraphicsSBase/SBDL-MAN/postinstall,v $
# $Revision: 550.2 $
# $Date: 96/07/16 11:10:07 $
#
########
#
# (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!!

	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

 	SBDL_DIR="$SW_LOCATION"
 
 	##
 	## Place path to top of man page directories into /etc/MANPATHi
 	## if not already present.
 	##
 	SBDL_MAN_PATH="${SBDL_DIR}share/man"
 	ETC_MANPATH="${SW_ROOT_DIRECTORY}etc/MANPATH"
 
 	if [ -f ${ETC_MANPATH} ]
 	then
 
 		fgrep "${SBDL_MAN_PATH}" ${ETC_MANPATH} > /dev/null 2>&1
 		FOUND_IT="$?"
 
 		if [ ${FOUND_IT} != "0" ]
 		then
 			##
 			## Need to put it into /etc/MANPATH
 			##
 			##TMP_MANPATH="`cat ${ETC_MANPATH}`"
                        TMP_MANPATH="`awk '{ print }' ${ETC_MANPATH}`"
                        TMP_MANPATH="${TMP_MANPATH}:${SBDL_MAN_PATH}"
 			echo "${TMP_MANPATH}" > ${ETC_MANPATH}
 		fi
 	fi
 
	exit $exitval
################################################################################
