#!/bin/sh
## /public/scripts/pcfesdistribute
## A Script to distribute compiled FES binaries and libraries to a WIN/NT machine.
## Classes files are copied into the /install/weblogic/classes.
## Also /usr/local/gwa bin and conf directories are created or updated.
## The file /usr/local/gwa/conf/sduagent.ini is updated.
## The external and CC jar files are copied.
## Input parameters are:
## 1. Build name
## 2. The release name
## 3. The installation package root directory
## 4. The installtion drive
## Last modified: 09-Jan-2002
if [ $# -lt 4 ]
then
echo ""
echo "Usage: $0 Build-name configuration-name installation-source-dir install-drive"
echo "Example: $0 Build2.0.1.6 prd_2.0 /cygdrive/e/ins c"
echo ""
exit 1
fi
BUILDNAME=$1
CNFNAME=$2
CNFN=`echo $CNFNAME | awk -F. '{print $1}'`
## Current date and time variable set
CURDATE=`date +%Y%m%d%H%M`
INSDIR=$3
if [ ! -d $INSDIR ]
then
echo ""
echo $INSDIR" is not exist. Exit..."
echo ""
exit 1
fi
VERDIR=`dirname $INSDIR`
WINDRIVE=$4
INSDRIVE="/cygdrive/"$WINDRIVE
if [ ! -d $INSDRIVE ]
then
echo ""
echo $INSDRIVE" is not exist. Exit..."
echo ""
exit 1
fi
## Host name compute
HST=`hostname`
## Full host name currently not in use. 4.12.2001.
#DMN=`ipconfig | grep "DNS Suffix" | awk '{print $NF}'`
#HOSTN=$HST"."$DMN
echo "Create Globecom software directories"
GWADIR=$INSDRIVE"/usr/local/gwa"
if [ -d $GWADIR ]
then
PREVGWA=$GWADIR"_"$CURDATE
mv $GWADIR $PREVGWA
echo ""
echo "Previous version of "$GWADIR" was saved as "$PREVGWA
echo ""
fi
rm -rf $GWADIR
mkdir -p $GWADIR
mkdir $GWADIR/bin $GWADIR/conf $GWADIR/logs $GWADIR/old_logs
# Copy the Java Jar files
echo "Copy the Java jar files"
JARSDIR=$INSDRIVE"/weblogic/classes/Jars"
if [ -d $JARSDIR ]
then
rm -f $INSDRIVE/weblogic/classes/Jars/*.jar
else
mkdir -p $JARSDIR
fi
for i in CC ipworks
do
cp -f $INSDIR/Java/Jars/$i.jar $INSDRIVE/weblogic/classes/Jars
done
# Determine system type
SYS=WIN
if test "$SYS" = "WIN"
then
echo 'Install on WIN system\n'
RELNAME=SUN-Rel-$1
else
echo "Unknown system to install Globecom server on.\n"
exit
fi
# Cleanup old release files
rm -rf $GWADIR/bin/*
# Copy the executables to $GWADIR/bin
cd $GWADIR/bin
echo " Copying binaries ...."
cp $INSDIR/conf/GLB/startFES.cmd .
cp $INSDIR/CI/XmlConvertor .
cp $INSDIR/CI/*.dll .
cp $INSDIR/MakeDB/windows/winfescleaner.bat .
# Cleanup old configuration files
rm -rf $GWADIR/conf/*
# Copy the configuration files to $GWADIR/conf
cd $GWADIR/conf
echo " Copying configuration files ...."
cp $INSDIR/conf/GLB/sduagent_win.ini ./sduagent.ini
cp $INSDIR/conf/GLB/lookup.conf ./lookup.conf
cp $INSDIR/conf/GLB/fesserv.conf ./fesserv.conf
cd $INSDRIVE/Program\ Files/Apache\ JServ\ 1.1.2/conf
cp $INSDIR/conf/GLB/zone.properties_win ./zone.properties
echo ""
echo "Please type the LCM server full host name"
read ANS
LCMSRVR=$ANS
echo ""
echo "Please type the SDU server full host name"
read ANS
SDUSRVR=$ANS
echo ""
echo "Please type the Traps Filter server full host name"
read ANS
SNMPSRVR=$ANS
echo ""
echo "Please type the Client-ID name (identical to the definition in the LCM server)"
read ANS
CLIENTID=$ANS
echo ""
echo "Please type the FES web access full name"
read ANS
FESWEBSRVR=$ANS
echo ""
echo "Please type the Convertor mode (epop | ncr | internet). default is internet"
read ANS
CONVMODE=$ANS
if [ "$CONVMODE" != "epop" -a "$CONVMODE" != "ncr" -a "$CONVMODE" != "internet" ]
then
CONVMODE="internet"
fi
echo ""
echo "Is Output reference from web server available (y/n)"
read ANS
if [ "$ANS" = "y" ]
then
OUTPUTREF="true"
else
OUTPUTREF="false"
fi
cd $GWADIR/conf
## Update fields in sduagent.ini
sed 's/win-drive/'$WINDRIVE'/' sduagent.ini | sed 's/lcm-srvr/'$LCMSRVR'/' | sed 's/sdu-srvr/'$SDUSRVR'/' | sed 's/snmp-name/'$SNMPSRVR'/' | sed 's/fes-webname/'$FESWEBSRVR'/' | sed 's/output-ref/'$OUTPUTREF'/' | sed 's/conv-mode/'$CONVMODE'/' | sed 's/client-id/'$CLIENTID'/' > sduagent.ini.$$
mv sduagent.ini.$$ sduagent.ini
cd $GWADIR/bin
## Update fields in startFES.cmd
sed 's/win-drive/'$WINDRIVE'/g' startFES.cmd > startFES.cmd.$$
mv startFES.cmd.$$ startFES.cmd
cd $GWADIR/conf
## Update fields in fesserv.conf
sed 's/host-name/'$HST'/g' fesserv.conf > fesserv.conf.$$
mv fesserv.conf.$$ fesserv.conf
cd $INSDRIVE/Program\ Files/Apache\ JServ\ 1.1.2/conf
## Update fields in zone.properties
sed 's/host-name/'$HST'/g' zone.properties | sed 's/win-drive/'$WINDRIVE'/' > zone.properties.$$
mv zone.properties.$$ zone.properties
## Update fields in jserv.properties
sed 's/host-name/'$HST'/g' jserv.properties | sed 's/win-drive/'$WINDRIVE'/' > jserv.properties.$$
mv jserv.properties.$$ jserv.properties
## Remove old IPAC files using batch file
echo ""
echo "To remove old IPACs resource files do: Open cmd window"
echo " cd <cydrive>:\usr\local\gwa\bin"
echo " Run : winfescleaner.bat <win-drive>"
echo ""
echo "---------------------------------------------------------------"
exit 0