#!/bin/bash

ls /usr/lib > /tmp/lslib
TCLHERE=`awk '/tclX/{++x} BEGIN {x=0} END {print x}' /tmp/lslib`
rm -rf /tmp/lslib
if [ $TCLHERE != "0" ]; then

	OSVER=`awk '/Red Hat Linux release 7.2/{++x} BEGIN {x=0} END {print x}' /etc/issue`
	if [ ${#OSVER} == 1 ]; then
		if [ ! -f /usr/lib/libtclx8.3.so ]; then
			if [ -f /usr/lib/libtclx.so ]; then
				cp /usr/lib/libtclx.so /usr/lib/libtclx8.3.so
			fi
		fi
	fi 
	
	if [ -e /usr/bin/tixwish ]; then
		TIXWISH=/usr/bin/tixwish
	elif [ -e /usr/bin/tixwish4.1.8.0 ]; then
		TIXWISH=/usr/bin/tixwish4.1.8.0
	elif [ -e /usr/bin/tixwish4.1.8.3 ]; then
		TIXWISH=/usr/bin/tixwish4.1.8.3
	else
  		echo "ERROR: tixwish not installed."
  		echo "X-Windows must be installed to use the IML viewer."
  		exit 1
	fi

	$TIXWISH /sbin/cpqimlview.tcl

else
	echo "ERROR: tclX not installed."
	echo "tclX must be installed to use the IML viewer."
	exit 1
fi

exit 0
