df_install.txt

text/plain df_install.txt — 9.4 KB

Dateiinhalt

#!/bin/sh
#--------1---------2---------3---------4---------5---------6---------7---------8
################################################################################
#                                                                              #
#       DYNAFORM/ETA Platform Independent Software Installation                #
#                                                                              #
#       File name:       df_install                                            #
#                                                                              #
#       Revision:        5.2 (15 October 2004)                                 #
#                                                                              #
#       Description: This script installs DF52 software on a workstation       #
#                    and retrieves Host ID for licensing.                      #
#                                                                              #
#       Usage:       To execute the script, type "./df_install"                #
#                                                                              #
#       Licensing:   Complete the online license request form at               #
#                    www.ETA.com or contact support@eta.com.                   #
#                                                                              #
################################################################################
#
# Internal input varivables
#
if test -d "DYNAFORMInstall"
then
	PACKAGE="DYNAFORMInstall"
	PRODUCT="DYNAFORM"
	RELEASE="5.2.1"
	BLDVERS="5.2.1.24Sep04"
	PURPOSE="Workstation" 
#
	TESTFILE="testfile.df.$$"
	VREGISTRY="registry"
	VR_PRODSTR="${PRODUCT}"
	PRODUCTDIR="ETA_DF5"
	PRODUCTFILE="dynaform3d"
	EXECNAME="df52"
#
else

echo ""
echo "Untar product file prior to run DF installation!"
echo ""

exit 1
      
#
fi
echo ""
echo "   ========================================================================"
echo ""
echo "        DYNAFORM/ETA Platform Independent Software Installation Script"
echo ""
echo "             This script installs ETA software on a workstation"
echo "                and retrieves Host ID for licensing."
echo ""
echo "             Product: ${PRODUCT} ${RELEASE}"
echo "             Purpose: ${PURPOSE} installation"
echo ""
echo "             ETA Software, Inc. - www.dynaform.com"
echo ""
echo "   ========================================================================"
echo ""

#
# See if we have to use the lame SYS-V echo command flags.
#
if test "`echo 'blah\c'`" = "blah\c"
then
      ECHO="echo -n"
      ENDR=""
else
      ECHO="echo"
      ENDR="\c"
fi

# Verify if user has correct package

	echo ""
	echo ""
	echo "This package is for ${PRODUCT} ${RELEASE} ${PURPOSE} installation."
	${ECHO} "Is that correct? (y/n)[y] ${ENDR}"
	read CHECK
	if test "${CHECK}" = "n" -o "${CHECK}" = "N"
	   then
		echo "ERROR: wrong installation package."
		exit 1
	   else
		echo "Correct installation package."
	fi

#
# Check machine Platform
#
# echo ""
# echo ""
# echo "Now trying to get your machine Platform..."
if test ! -z "`ls /bin/uname`"
then
        case `/bin/uname` in
                OSF | OSF1 | OSF4)
                        PLATFORM="OSF"
				PLATLIST="1"
                ;;
                HP-UX)
                        PLATFORM="HP-UX"
				PLATLIST="2"
                ;;
                AIX)
                        PLATFORM="AIX"
				PLATLIST="3"
                ;;
                IRIX | IRIX64)
                        PLATFORM="IRIX"
				PLATLIST="4"
                ;;
                SunOS | Solaris)
                        PLATFORM="SOLARIS"
				PLATLIST="5"
                ;;
                Linux | LINUX)
                        PLATFORM="LINUX"
				PLATLIST="6"
                ;;
                *)
                        PLATFORM=""
				PLATLIST=""
                ;;
        esac
fi
#
# Make sure the package we expect is where we expect it.
#
if test ! -d ${PACKAGE}
then
	echo "ERROR: ${PACKAGE}: no such directory or file"
	exit 1
fi
#
if test -d /opt
then
	INSTALL_DIR="/usr/local/${PRODUCTDIR}"
else
	INSTALL_DIR="/opt/${PRODUCTDIR}"
fi
#
# Routine to check if input path start with "/"
#
FilterPathName ()
{
  newpathname="$1"
  case "$newpathname" in
    ~*)
      if [ -f /bin/csh -a -x /bin/csh ] ; then
        newpathname=`/bin/csh -c "echo $newpathname"`
      fi
      ;;
    ../*|./*)
      newpathname=`pwd`/"${newpathname}"
      ;;
    *)
      ;;
  esac
  eval newpathname=\"${newpathname}\"
  echo "${newpathname}"
}
#
# Inquire user for input path
#
flag=1
while test ${flag} -eq 1
do
	echo "Location for ${PRODUCT} software:"
	echo "   (1)[${HOME}/${PRODUCTDIR}]"
# Verify user is root
	if test `id | cut -c5` = "0"
	then
	  echo "   (2)[${INSTALL_DIR}]"
	fi
	${ECHO} "Make selection or Input path: [1] ${ENDR}"
	read TARGET
	if test -z "${TARGET}" -o "${TARGET}" = "1"
	then
		TARGET="${HOME}/${PRODUCTDIR}"
	elif test "${TARGET}" = "2"
	then
		TARGET="${INSTALL_DIR}"
	else
  		newpathname="${TARGET}"
  		case "$newpathname" in
    		~*)
      		if [ -f /bin/csh -a -x /bin/csh ] ; then
        		newpathname=`/bin/csh -c "echo $newpathname"`
      		fi
      		;;
    		../*|./*)
      		newpathname=`pwd`/"${newpathname}"
      		;;
    		/*)
      		;;
    		*)
		newpathname=`pwd`/"${newpathname}"
      		;;
  		esac
  		eval newpathname=\"${newpathname}\"
		TARGET="${newpathname}"
	fi
#
	flag=0
	if test ! -d ${TARGET}
	then
		echo ""
		echo "${TARGET}: No such directory."
		${ECHO} "Do you wish to create it? (y/n)[y] ${ENDR}"
		read check
		if test "${check}" = "n" -o "${check}" = "N"
		then
			flag=1
		else
			#
			# The -p flag may cause an error on some HP-UX systems.
			# Removing the -p will work for 'basename TARGET' as long
			# as 'dirname TARGET' exists.
			#
			mkdir -p ${TARGET}
			if test $? -ne 0
			then
				echo "ERROR: Problem creating ${TARGET}"
				exit 2
			fi
		fi
	else
		echo ""
		echo "Existing '${TARGET}' directory found."
		echo ""
		echo "The existing contents may be modified or replaced!!!"
		${ECHO} "Do you really want to install in this directory? (y/n)[y] ${ENDR}"
		read check
		if test "${check}" = "n" -o "${check}" = "N"
		then
			flag=1
		fi
	fi
#
	if test ${flag} -eq 0
	then
		(echo "Write test." 2>/dev/null > ${TARGET}/${TESTFILE}) 2>/dev/null
		if test $? -ne 0
		then
			echo ""
			echo "You do not have write permission in ${TARGET}."
			echo "Change the permissions, or select another directory, and try again."
			echo ""
			flag=1
		else
			/bin/rm -f ${TARGET}/${TESTFILE}
		fi
	fi
done
#
# Begin the installation.
#
[ ${PACKAGE} = "DFallInstall" ] && {
echo 
echo "Please Select the platform below that you want to install."
echo
echo "  0   ALL platforms"
echo "  1   DEC/ALPHA"
echo "  2   HP" 
echo "  3   IBM" 
echo "  4   SGI" 
echo "  5   SUN" 
echo "  6   LINUX"
echo
echo "Select the platforms to install by selecting 0-6."
echo "Multi platforms can be selected by input 1-6 separate by comma or space: [0]"
read ans
if test "${ans}" = "0" -o "${ans}" = "" 
then
 PLATLIST="1 2 3 4 5 6"
else
 PLATLIST=`echo ${ans} | tr "," " "`
fi
}

LOGFILE="${PRODUCT}-install.log-$$"
date > ${LOGFILE}

for i in ${PLATLIST}
do
#
   case ${i} in
   1) PLATINSTALL="OSF" ;;
   2) PLATINSTALL="HP-UX" ;;
   3) PLATINSTALL="AIX" ;;
   4) PLATINSTALL="IRIX" ;;
   5) PLATINSTALL="SOLARIS" ;;
   6) PLATINSTALL="LINUX" ;;
   esac
#
#
# Check the product
#
if test -d ${PACKAGE}/${PLATINSTALL}
then
#
# Keep a log of this installation for reference.
#
echo "Files installed:" >> ${LOGFILE}
echo "================" >> ${LOGFILE}
echo ""
echo "Installing ${PLATINSTALL}/${PRODUCT} files."
echo "Installing ${PLATINSTALL}/${PRODUCT} files." >> ${LOGFILE}
# Check for existing files with the same names and save them.
if test -d ${TARGET}/${PLATINSTALL}
then
      /bin/rm -rf ${TARGET}/${PLATINSTALL}.old
      mv -f ${TARGET}/${PLATINSTALL} ${TARGET}/${PLATINSTALL}.old
      echo "The directory '${TARGET}/${PLATINSTALL}' had been removed to '${TARGET}/${PLATINSTALL}.old'" >> ${LOGFILE}
fi
  echo "copying files..."
  echo "copying files..." >> ${LOGFILE}
  cp -R ${PACKAGE}/${PLATINSTALL} ${TARGET}/${PLATINSTALL}
  ls -1a ${PACKAGE}/${PLATINSTALL} >> ${LOGFILE}
else
      echo ""
      echo "ERROR: no ${PACKAGE}/${PLATINSTALL} directory or file"
fi

done

#
echo ""
echo "The ETA ${PRODUCT} file transfer is completed."
echo "==================================================" 
echo "================" >> ${LOGFILE}
echo "The ETA ${PRODUCT} file transfer is completed." >> ${LOGFILE}
echo ""
#remove temp files
    /bin/rm -rf ${PACKAGE}
    echo "Please see file ${LOGFILE} for detail infomation of installation."
#
# Write executable script to launch application (test if Solaris)
# REM: SunOS request extra enviroment sets
#
	echo ""
	echo ${TARGET}/${PLATFORM}/df52>${EXECNAME}
	chmod 755 ${EXECNAME}
ed - ${TARGET}/${PLATFORM}/df52  <<-END_OF_CAT
/DYNAFORM_PATH=/c
DYNAFORM_PATH=${TARGET}/${PLATFORM}; export DYNAFORM_PATH;
.
w
q
END_OF_CAT
ed - ${TARGET}/${PLATFORM}/etapost  <<-END_OF_CAT
/ETAPOST_PATH=/c
ETAPOST_PATH=${TARGET}/${PLATFORM}; export ETAPOST_PATH;
.
w
q
END_OF_CAT
	echo "${PRODUCT} installation completed."
	echo "Type '${EXECNAME}' to run ${PRODUCT} ${RELEASE} after you get the license."
	echo "===================================================================" 
#
# Try to get eta.log file for licensing
#
echo ""
echo ""
	echo "Please complete the online license request form at"
	echo "www.eta.com  and send the eta.log file to support@eta.com"
	echo "for a valid license."
	echo ""
		./${EXECNAME} 
exit 0