#!/bin/sh
# @(#)install  $Revision: 1.24 $  $Date: 1994/01/17 17:43:24 $
# @(#)linked to get_license_info, add_license_info, start_lm, post_install
# @(#)Copyright(c) 1993,1994 by Rational.

log=install.log
command=`basename $0`
install_dir=`dirname $0`
install_dir=`(cd $install_dir; pwd)`
install_dir_name=`basename $install_dir`

echo "----------------------------------------------------------------" >> $log

if [ "$install_dir_name" != install ]
then
    echo "Error: you must be in the install directory to run $command."
    exit 1
fi

# Load Rational's shell function library
if [ -r install_lib ]
then
    . ./install_lib
else
    echo "Error: install_lib not found.  The install directory:"
    echo "    $install_dir"
    echo "is not complete."
    echo "Was there an error during the initial tape or disk read?"
    exit 1
fi
install_dir=`cpath $install_dir`

# Make sure the install directory and the log file are writable by all.
if  [ $command != start_lm ]
then
    chmod a+w $log 2>/dev/null
    chmod a+w $install_dir 2>/dev/null
fi

echo "$command: Started `date`" >> $log

. ./do_$command $* 2>&1 | tee -a $log

if  [ $command = get_license_info ]
then
    status=`get_var GET_LICENSE_INFO`
    if [ "$status" = COMPLETED ]
    then
        if [ -f license_information ]
        then
            separator
            more license_information
        fi
    fi
fi

if [ $command = install ]
then
    status=`get_var INST_STATUS`
    if [ "$status" = COMPLETED ]
    then
        install_text=`/bin/ls *.inst_text`
        if [ -f "$install_text" ]
        then
            separator
            more $install_text
        fi
    fi
fi

