#!/bin/sh if [ $# -lt 2 ]; then echo "install usage: install compressed_tar_file_name destination_directory" exit 1 fi compress_file=$1 tar_file=`basename $compress_file .Z` dest_dir=$2 if [ ! -f $compress_file ]; then echo "Specified compress tar file ($compress_file) does not exist. " echo "Please check that you have specified the file name correctly." exit 1 fi if [ ! -r $compress_file ]; then echo "You do not have read permission on the specified tarfile ($compress_file) ." echo "Please change the permissions on the file and re-issue the install command." exit 1 fi if [ ! -d $dest_dir ]; then ans="" while [ "$ans" != "y" -a "$ans" != "Y" ]; do echo "You have specified a new destination directory." echo "Do you wish to create this new directory (y or n) ->\c" read ans if [ $ans = "n" -o $ans = "N" ]; then echo "Please respecify a different destination directory." exit 1 fi done fi echo "Uncompressing $compress_file" uncompress $compress_file echo "Untarring $tar_file" if tar -xf $tar_file; then compress $tar_file # we should now have the contents of the tar file in the current directory # execute the tool specific install if [ ! -x "ut_tool_install" ]; then echo "Cannot execute the Utilitek install script!!" echo "Please report this to Utilitek Systems." exit 1 fi if ./ut_tool_install $dest_dir; then # the install script is supposed to clean up after itself - the only thing that we should # have to cleanup is the tool_install script itself echo "Installation completed successfully." rm ./ut_tool_install exit 0 else echo "Errors reported during installation phase." echo "Please correct any errors and rerun the installation" rm ./ut_tool_install exit 1 fi else compress $tar_file echo "Error detected in extracting the contents of the tar file!" echo "Please look for error messages and correct any problems reported." exit 1 fi