#!/sbin/sh

########
# Product:  GraphicsCommon
# Fileset:  STAR-RUN
# unconfigure
#
# $Source: /hmstmp/update.25011/./release/SD/GraphicsCommon/STAR-RUN/unconfigure,v $
# $Revision: 550.2 $
# $Date: 96/07/16 11:09:46 $
#
########
#
# (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

	DEFAULTS_FILE="config/defaults"
	STROKE_DIR="stroke"
	RASTER_DIR="raster"
	ETC_OPT_DIR="${SW_ROOT_DIRECTORY}etc/opt/starbase"

	DEFAULTS_SYM_LINK="$ETC_OPT_DIR/defaults"
	STROKE_SYM_LINK="$ETC_OPT_DIR/stroke"
	RASTER_SYM_LINK="$ETC_OPT_DIR/raster"

	DEFAULTS_TARGET="${SW_INSTALL_DIR}${DEFAULTS_FILE}"
	STROKE_TARGET="${SW_INSTALL_DIR}${STROKE_DIR}"
	RASTER_TARGET="${SW_INSTALL_DIR}${RASTER_DIR}"

	##
	##  Remove the symbolic links for defaults, raster and stroke.
	##  The links may have been replaced by customer modified files
	##  so only remove links and not files!!
	##
	if [ -d $ETC_OPT_DIR ]
	then

		if [ -h $DEFAULTS_SYM_LINK ]
		then
			rm -f $DEFAULTS_SYM_LINK > /dev/null 2>&1
		fi

		if [ -h $STROKE_SYM_LINK ]
		then
			rm -f $STROKE_SYM_LINK > /dev/null 2>&1
		fi

		if [ -h $RASTER_SYM_LINK ]
		then
			rm -f $RASTER_SYM_LINK > /dev/null 2>&1
		fi
	fi
	exit $exitval
################################################################################
