#!/bin/sh
## /public/scripts/WINDistributeRelease
## A Script to distribute compiled binaries and libraries to a WIN/NT test machine.
## Globecom Classes files are copied into the /install/weblogic/classes.
## Also /usr/local/gwa bin and conf directories are created or updated.
## The file /install/weblogic/EJB_Param.ini is updated.
## The external and Admin jar files are copied.
## Two input parameters are required:
## 1. Build name
## 2. The release name
## 3. The installation package root directory
## Last modified: 1.10.2001
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}'`
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"
[ ! -d $GWADIR ] && mkdir -p $GWADIR
[ ! -d $GWADIR/bin ] && mkdir $GWADIR/bin
[ ! -d $GWADIR/conf ] && mkdir $GWADIR/conf
[ ! -d $INSDRIVE/var ] && mkdir $INSDRIVE/var
[ ! -d $INSDRIVE/var/zax ] && mkdir $INSDRIVE/var/zax
[ ! -d $INSDRIVE/inetpub/ftproot/publisher ] && mkdir $INSDRIVE/inetpub/ftproot/publisher
[ ! -d $INSDRIVE/inetpub/ftproot/publisherlog ] && mkdir $INSDRIVE/inetpub/ftproot/publisherlog
# 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/XmlConvertor.exe .
# 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/zax_win.conf ./zax.conf
sed 's/win-drive/'$WINDRIVE'/' zax.conf > zax.conf.$$
mv zax.conf.$$ zax.conf
# Copy the Dlls to system directory
echo " Copying Xerces dlls ...."
cd $SYSTEMROOT/system32
rm -f xerces*.dll
cp $INSDIR/EPOP-Source/xerces*.dll .
## Create lptpp directory
[ ! -d $INSDRIVE/weblogic/lptpp ] && mkdir $INSDRIVE/weblogic/lptpp
## Copy the java classes and the deployment files into ~weblogic/classes
[ ! -d $INSDRIVE/weblogic/classes ] && mkdir $INSDRIVE/weblogic/classes
[ ! -d $INSDRIVE/weblogic/classes/globecom ] && mkdir $INSDRIVE/weblogic/classes/globecom
if [ "$CNFN" = "prd_2" ]
then
[ ! -d $INSDRIVE/weblogic/classes/globecom/deploy ] && mkdir $INSDRIVE/weblogic/classes/globecom/deploy
cd $INSDRIVE/weblogic/classes/globecom/deploy
rm -f *
cp -f $INSDIR/deploy/* $INSDRIVE/weblogic/classes/globecom/deploy
else
[ ! -d $INSDRIVE/weblogic/classes/deploy ] && mkdir $INSDRIVE/weblogic/classes/deploy
cd $INSDRIVE/weblogic/classes/deploy
rm -f *
cp -f $INSDIR/deploy/* $INSDRIVE/weblogic/classes/deploy
fi
## Java classes swapped by CC.jar
rm -rf globecom
#echo " Copying Globecom classes files ...."
#cp $INSDIR/JavaClasses-$RELNAME.tar.gz .
#gunzip JavaClasses-$RELNAME.tar.gz
#/usr/bin/tar xvf JavaClasses-$RELNAME.tar
#rm -f *.tar
# 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
cp -f $INSDIR/Java/Jars/* $INSDRIVE/weblogic/classes/Jars
## Current date and time variable set
CURDATE=`date +%Y%m%d%H%M`
# Handling EJB_Param.ini
echo " Update EJB_Param.ini ...."
EJBPFILE=$INSDRIVE/weblogic/EJB_Param.ini
if [ -f $EJBPFILE ]
then
PREVEJB=$EJBPFILE"_"$CURDATE
mv $EJBPFILE $PREVEJB
echo ""
echo "Previous version of EJB_Param.ini was saved as "$PREVEJB
echo ""
fi
cp $INSDIR/conf/GLB/EJB_Param.ini_standalone $EJBPFILE
sed 's/win-drive/'$WINDRIVE'/' $EJBPFILE > $EJBPFILE.$$
mv $EJBPFILE.$$ $EJBPFILE
sed 's/host-name/'$HST'/' $EJBPFILE > $EJBPFILE.$$
mv $EJBPFILE.$$ $EJBPFILE
HOSTIP=`ipconfig | grep "IP Address" | awk '{print $NF}'`
sed 's/host-ip/'$HOSTIP'/' $EJBPFILE > $EJBPFILE.$$
mv $EJBPFILE.$$ $EJBPFILE
# Create preview directory
echo "Create preview directory ...."
PREVIEWDIR=`grep SECURED_PATH $EJBPFILE | awk '{print $NF}' | awk -F: '{print "/cygdrive/"$1$2"preview"}'`
[ ! -d $PREVIEWDIR ] && mkdir -p $PREVIEWDIR
# Create LPTPP directory
echo "Create LPTPP directory ...."
LPTPPDIR=`grep LPTPP_FILES_PATH $EJBPFILE | awk '{print $NF}' | awk -F: '{print "/cygdrive/"$1$2}'`
[ ! -d $LPTPPDIR ] && mkdir -p $LPTPPDIR
# Create Logs directory
echo "Create Logs directory ...."
LOGSDIR=`grep "^LOGGER_DIRECTORY" $EJBPFILE | awk '{print $NF}' | awk -F: '{print "/cygdrive/"$1$2}'`
[ ! -d $LOGSDIR ] && mkdir -p $LOGSDIR
# Create old Logs directory
echo "Create old Logs directory ...."
OLDLOGSDIR=`grep "OLD_LOGGER_DIRECTORY" $EJBPFILE | awk '{print $NF}' | awk -F: '{print "/cygdrive/"$1$2}'`
[ ! -d $OLDLOGSDIR ] && mkdir -p $OLDLOGSDIR
# Handling weblogic.properties
echo " Update weblogic.properties ...."
WPFILE=$INSDRIVE/weblogic/weblogic.properties
if [ -f $WPFILE ]
then
PREVWP=$WPFILE"_"$CURDATE
mv $WPFILE $PREVWP
echo ""
echo "Previous version of weblogic.properties was saved as "$PREVWP
fi
cp $INSDIR/conf/GLB/weblogic.properties_standalone $WPFILE
sed 's/win-drive/'$WINDRIVE'/' $WPFILE > $WPFILE.$$
mv $WPFILE.$$ $WPFILE
sed 's/host-name/'$HST'/' $WPFILE > $WPFILE.$$
mv $WPFILE.$$ $WPFILE
# Create SDU directory
echo "Create SDU directory ...."
SDUDIR="/cygdrive/"$WINDRIVE"/sdu"
[ ! -d $SDUDIR ] && mkdir -p $SDUDIR
# Create SDU-misc directory
echo "Create SDU_misc directory ...."
SDUMISCDIR="/cygdrive/"$WINDRIVE"/sdu_misc"
[ ! -d $SDUMISCDIR ] && mkdir -p $SDUMISCDIR
# Handling startWebLogic.bat
echo " Update startWebLogic.bat ...."
SWLFILE=$INSDRIVE/weblogic/startWebLogic.bat
if [ -f $SWLFILE ]
then
PREVSWL=$SWLFILE"_"$CURDATE
mv $SWLFILE $PREVSWL
echo ""
echo "Previous version of startWebLogic.bat was saved as "$PREVSWL
fi
cp $INSDIR/conf/GLB/startWebLogic.bat $SWLFILE
sed 's/win-drive/'$WINDRIVE'/' $SWLFILE > $SWLFILE.$$
mv $SWLFILE.$$ $SWLFILE
# Copying chmod.exe program
echo " Update chmod.exe ...."
CHMODFILE=$INSDRIVE/weblogic/chmod.exe
if [ ! -f $CHMODFILE ]
then
if [ -f $INSDIR/conf/GLB/chmod.exe ]
then
cp $INSDIR/conf/GLB/chmod.exe $CHMODFILE
fi
fi
# Copying license files
echo " Update weblogic rishuy files ...."
LICJFILE=$INSDRIVE/weblogic/license/WebLogicLicense.java
if [ -f $LICJFILE ]
then
mv $LICJFILE $LICJFILE"_"$CURDATE
fi
cp $INSDIR/conf/GLB/WebLogicLicense.java $LICJFILE
LICXFILE=$INSDRIVE/weblogic/license/WeblogicLicense.xml
if [ -f $LICXFILE ]
then
mv $LICXFILE $LICXFILE"_"$CURDATE
fi
cp $INSDIR/conf/GLB/WeblogicLicense.xml $LICXFILE
# Copy the images files
echo " Copying images files ...."
IMAGESDIR=$INSDRIVE/weblogic/myserver/public_html/images
if [ -d $IMAGESDIR ]
then
rm -f $IMAGESDIR/*
else
mkdir -p $IMAGESDIR
fi
cp -f $INSDIR/images/* $IMAGESDIR
# Copy the help files
echo " Copying help files ...."
HELPDIR=$INSDRIVE/weblogic/myserver/public_html/help
if [ -d $HELPDIR ]
then
rm -f $HELPDIR/*
else
mkdir -p $HELPDIR
fi
cp -f $INSDIR/help/* $HELPDIR
# Copy Admin and cancel html files
echo " Copying Admin.html and Cancel.html files ...."
HTMLDIR=$INSDRIVE/weblogic/myserver/public_html
rm -f $HTMLDIR/Admin.html $HTMLDIR/Cancel.html
cp -f $INSDIR/conf/GLB/Admin.html_standalone $HTMLDIR/Admin.html
cp -f $INSDIR/conf/GLB/Cancel.html $HTMLDIR
# Copy Database scripts files
echo " Copying Database scripts ...."
DBADIR=$INSDRIVE/MakeDB/Windows
rm -rf $DBADIR
mkdir -p $DBADIR
cp -f $INSDIR/MakeDB/Windows/* $DBADIR
# Copy public scripts files
echo " Copying public scripts ...."
SCRIPTSDIR=$INSDRIVE/scripts
rm -rf $SCRIPTSDIR
mkdir -p $SCRIPTSDIR
cp -f $VERDIR/scripts/* $SCRIPTSDIR
# Create log files directories
echo " Create log files directories...."
[ ! -d $INSDRIVE/weblogic/MgsLogFiles_new ] && mkdir $INSDRIVE/weblogic/MgsLogFiles_new
[ ! -d $INSDRIVE/weblogic/MgsLogFiles_old ] && mkdir $INSDRIVE/weblogic/MgsLogFiles_old
echo "---------------------------------------------------------------"
exit 0