#!/bin/sh
################ UMT Install script for IRIX ####################

OLD_PATH=$PATH
PATH=/bin:/usr/bin:/usr/local/bin
UMT_LIB_DIR=/usr/local/lib
UMT_BIN_DIR=/usr/local/bin
X11_AD_DIR=/usr/lib/X11/app-defaults
ICONS_DIR=/usr/lib/images

SRC_DIR=`pwd`
for dir in / `echo $UMT_LIB_DIR | sed y\|/\|\ \|` $UMT_BIN_DIR
do
	if [ ! -d $dir ]; then 
		mkdir $dir && chmod a+rx $dir
		if [ $? != 0 ]; then
			echo "Error making directory $dir"
			exit 1
		fi
	fi
	cd $dir
done
echo "Untaring UMT service directory to $UMT_LIB_DIR..."
cd $UMT_LIB_DIR && tar -xpvf $SRC_DIR/UMT.tar
if [ $? != 0 ]; then
	echo "Error untaring archive."
	exit 1
fi
echo "Ok"
cd $SRC_DIR
echo "Coping umt      -> $UMT_BIN_DIR"
echo "       UMT.cfg  -> $UMT_LIB_DIR"
echo "       UMT.ad   -> $X11_AD_DIR/UMT"
echo "       UMT.icon -> $ICONS_DIR/UMT.icon"
cp umt $UMT_BIN_DIR && \
chmod a=rx $UMT_BIN_DIR/umt && \
	cp UMT.cfg $UMT_LIB_DIR && \
	chmod a+r $UMT_LIB_DIR/UMT.cfg && \
		cp UMT.ad $X11_AD_DIR/UMT && \
		chmod a+r $X11_AD_DIR/UMT && \
			cp UMT.icon $ICONS_DIR/UMT.icon && \
			chmod a+r $ICONS_DIR/UMT.icon
if [ $? != 0 ]; then
	echo "Error coping."
	exit 1
fi
echo "Ok"
echo ""
echo ""
echo ""
echo "        UMT is successfully installed."


