#!/bin/sh
## /public/scripts/DistributeRelease
## A Script to distribute compiled binaries and libraries to a test machine.
## Three tar files are untarred into the /usr/local/gwa bin and lib directories.
## and the Java classes into ~weblogic .
## Two input parameters are required:
## 1. The build name
## 2. The release name
## 3. Configuration setup : automat|manual
## 4. The resources directory (default is /data/var)
## Last modified: 19.7.2001
if [ $# -lt 3 ]
then
echo ""
echo "Usage: $0 build-name configuration-name configuration-setup(lcm | fes | none)"
echo "Example: $0 Build2.0.1.6 prd_2.0 lcm"
echo ""
exit 1
fi
CNFNAME=$2
CNFN=`echo $CNFNAME | awk -F. '{print $1}'`
INSDIR="/public/"$CNFNAME"/ins"
if [ ! -d $INSDIR ]
then
echo ""
echo $INSDIR" is not exist. Exit..."
echo ""
exit 1
fi
CONFSETUP=$3
if [ ! "$CONFSETUP" = "fes" -a ! "$CONFSETUP" = "lcm" ]
then
CONFSETUP="none"
fi
#if [ $# -lt 4 ]; then
ResrcDir="/data/var" ## Default resource directory
#else
# ResrcDir=$4
#fi
ISGENUITY="n"
hostname | grep ".genuity." > /dev/null
if [ "$?" = "0" ]
then
ISGENUITY="y"
fi
## Stop Globecom services
/public/scripts/glbservices stop
echo "Stopping Globecom services. Please wait..."
sleep 5
## Current date and time variable set
CURDATE=`date +%Y%m%d%H%M`
## Save previous version configuration files in a backup directory, for reference
REFDIR=/tmp/conf_dirs_$CURDATE
mkdir $REFDIR
mkdir $REFDIR/gwa $REFDIR/apache $REFDIR/weblogic
cp -r /usr/local/gwa/conf $REFDIR/gwa
cp -r /usr/local/apache/conf $REFDIR/apache
for i in weblogic.properties weblogic.policy startWebLogic.sh EJB_Param.ini
do
cp /install/weblogic/$i $REFDIR/weblogic
done
echo "$# args. Resource dir is $ResrcDir"
[ ! -d /usr/local/gwa ] && mkdir /usr/local/gwa
[ ! -d /usr/local/gwa/bin ] && mkdir /usr/local/gwa/bin
[ ! -d /usr/local/gwa/lib ] && mkdir /usr/local/gwa/lib
[ ! -d /usr/local/gwa/logs ] && mkdir /usr/local/gwa/logs
[ ! -d /usr/local/gwa/logs/new_logs ] && mkdir /usr/local/gwa/logs/new_logs
[ ! -d /usr/local/gwa/logs/old_logs ] && mkdir /usr/local/gwa/logs/old_logs
[ ! -d /usr/local/gwa/conf ] && mkdir /usr/local/gwa/conf
#[ ! -d /usr/local/gwa/share ] && mkdir /usr/local/gwa/share
#[ ! -d /usr/local/gwa/share/npdd ] && mkdir /usr/local/gwa/share/npdd
[ ! -d /usr/local/gwa/sdu ] && mkdir /usr/local/gwa/sdu
[ ! -d /usr/local/gwa/sdu_misc ] && mkdir /usr/local/gwa/sdu_misc
chown www:www /usr/local/gwa/sdu /usr/local/gwa/sdu_misc
chmod 777 /usr/local/gwa/sdu /usr/local/gwa/sdu_misc
# Determine system type
SYS=`uname`
if test "$SYS" = "Linux"
then
echo 'Install Linux system\n'
RELNAME=LNX-Rel-$1
elif test "$SYS" = "SunOS"
then
uname -a | grep -i sparc
if [ $? -eq 0 ]
then
echo 'Install Sparc SunOS system\n'
RELNAME=SUN-Rel-$1
else
SYS="INTL"
echo 'Install Intel SunOS system\n'
RELNAME=INTL-Rel-$1
fi
else
echo "Unknown system to install Globecom server on.\n"
exit
fi
# Cleanup old release files
rm -rf /usr/local/gwa/bin/*
rm -rf /usr/local/gwa/lib/*
# Copy the executables to /usr/local/gwa/bin
cd /usr/local/gwa/bin
# Start copying binaries
echo " Copying binaries ...."
cp $INSDIR/Bin-$RELNAME.tar.gz .
gunzip Bin-$RELNAME.tar.gz
/usr/bin/tar xvf Bin-$RELNAME.tar
rm *.tar
# Copy the libraries to /usr/local/gwa/lib
cd /usr/local/gwa/lib
# Start copying libraries
echo " Copying libraries ...."
cp $INSDIR/Lib-$RELNAME.tar.gz .
gunzip Lib-$RELNAME.tar.gz
/usr/bin/tar xvf Lib-$RELNAME.tar
rm *.tar
# Copy Apache handlers to /usr/apache/libexec
#mkdir -p /usr/local/apache/libexec
#echo "Copying Apache handlers to /usr/local/apache/libexec...."
#rm -f /usr/local/apache/libexec/*.so
#cp /usr/local/gwa/lib/pici.so /usr/local/apache/libexec/
#cp /usr/local/gwa/lib/rus.so /usr/local/apache/libexec/
#cp /usr/local/gwa/lib/sda.so /usr/local/apache/libexec/
#cp /usr/local/gwa/lib/zax.so /usr/local/apache/libexec/
#cp /usr/local/gwa/lib/poll.so /usr/local/apache/libexec/
#cp /usr/local/gwa/lib/sdu.so /usr/local/apache/libexec/
#cp /usr/local/gwa/lib/sduack.so /usr/local/apache/libexec/
#cp /usr/local/gwa/lib/sduhalt.so /usr/local/apache/libexec/
#cp /usr/local/gwa/lib/sdustat.so /usr/local/apache/libexec/
# In Genuity servers farm, Copy Apache handlers to /wh/stronghold/https-gin.gcin.net-http-80/libexec
#if [ "$ISGENUITY" = "y" ]
#then
# GENUITY_LIBEXEC=/wh/stronghold/https-gin.gcin.net-http-80/libexec
# mkdir -p $GENUITY_LIBEXEC
# echo "Copying Apache handlers to "$GENUITY_LIBEXEC" ...."
#rm -f $GENUITY_LIBEXEC/*.so
# cp /usr/local/gwa/lib/pici.so $GENUITY_LIBEXEC/
# cp /usr/local/gwa/lib/rus.so $GENUITY_LIBEXEC/
# cp /usr/local/gwa/lib/sda.so $GENUITY_LIBEXEC/
# cp /usr/local/gwa/lib/zax.so $GENUITY_LIBEXEC/
# cp /usr/local/gwa/lib/poll.so $GENUITY_LIBEXEC/
# cp /usr/local/gwa/lib/sdu.so $GENUITY_LIBEXEC/
# cp /usr/local/gwa/lib/sduack.so $GENUITY_LIBEXEC/
# cp /usr/local/gwa/lib/sduhalt.so $GENUITY_LIBEXEC/
# cp /usr/local/gwa/lib/sdustat.so $GENUITY_LIBEXEC/
#fi
# Copy system startup scripts
echo "Copying system startup scripts to /etc/init.d ...."
for i in wlsrv dbora
do
if [ "$SYS" = "Linux" ]
then
cd /etc/rc.d/init.d
cp $i $i.orig
cp $INSDIR/conf/GLB/$i .
chmod 755 /etc/rc.d/init.d/$i
else
cd /etc/init.d
cp $i $i.orig
cp $INSDIR/conf/GLB/$i .
chmod 755 /etc/init.d/$i
fi
done
# Copy gwa shared files
#echo "Copying shared files ...."
#cd /usr/local/gwa/share
#cp $INSDIR/Share/* .
# Create configuration directories
echo "Creating configuration directories ...."
[ ! -d $ResrcDir ] && mkdir $ResrcDir
chown www:www $ResrcDir
chmod 777 $ResrcDir
[ ! -d $ResrcDir/spool ] && mkdir $ResrcDir/spool
chown www:www $ResrcDir/spool
chmod 777 $ResrcDir
[ ! -d $ResrcDir/sdu ] && mkdir $ResrcDir/sdu
chown www:www $ResrcDir/sdu
[ ! -d $ResrcDir/spool/sdu ] && mkdir $ResrcDir/spool/sdu
chown www:www $ResrcDir/spool/sdu
[ ! -d $ResrcDir/spool/kiosk ] && mkdir $ResrcDir/spool/kiosk
chown www:www $ResrcDir/spool/kiosk
chmod 777 $ResrcDir/spool/kiosk
[ ! -d $ResrcDir/pici ] && mkdir $ResrcDir/pici
chown www:www $ResrcDir/pici
[ ! -d $ResrcDir/pici/base ] && mkdir $ResrcDir/pici/base
chown www:www $ResrcDir/pici/base
[ ! -d $ResrcDir/zax ] && mkdir $ResrcDir/zax
rm -rf $ResrcDir/zax/misc
[ ! -d $ResrcDir/zax/misc ] && mkdir $ResrcDir/zax/misc
cp $INSDIR/misc/Unix/* $ResrcDir/zax/misc
cp $INSDIR/misc/*.gif $ResrcDir/zax/misc
cp $INSDIR/misc/*.class $ResrcDir/zax/misc
chown -R www:www $ResrcDir/zax
[ ! -d $ResrcDir/spool/$HOST ] && mkdir $ResrcDir/spool/$HOST
chown www:www $ResrcDir/spool/$HOST
[ ! -d $ResrcDir/spool/$HOST/sda ] && mkdir $ResrcDir/spool/$HOST/sda
chown www:www $ResrcDir/spool/$HOST/sda
[ ! -d /var/run ] && mkdir /var/run
chown www:www /var/run
#chown www:www /usr/local/gwa/share/sdu.dat
#chmod 666 /usr/local/gwa/share/sdu.dat
[ ! -d $ResrcDir/gindocs ] && mkdir $ResrcDir/gindocs
chown www:www $ResrcDir/gindocs
[ ! -d $ResrcDir/tmp ] && mkdir $ResrcDir/tmp
chown www:www $ResrcDir/tmp
chmod 777 $ResrcDir/tmp
[ ! -d /usr/local/real ] && mkdir /usr/local/real
[ ! -d $ResrcDir/real ] && mkdir $ResrcDir/real
[ ! -d $ResrcDir/real/Content ] && mkdir $ResrcDir/real/Content
chown www:www $ResrcDir/real/Content
[ ! -d /usr/local/real/Logs ] && mkdir /usr/local/real/Logs
chown www:www /usr/local/real/Logs
#chown www:www /usr/local/gwa/share/npdd
chmod -R 777 /usr/local/apache/logs
if [ ! -d /install/weblogic ]
then
mkdir /install/weblogic
fi
chown -R weblogic /install/weblogic
chgrp -R weblogic /install/weblogic
chmod -R 755 /install/weblogic
if [ ! -d /install/weblogic/lptpp ]
then
mkdir /install/weblogic/lptpp
fi
chown -R weblogic /install/weblogic/lptpp
chgrp -R weblogic /install/weblogic/lptpp
chmod -R 777 /install/weblogic/lptpp
if [ ! -d /install/weblogic/classes ]
then
mkdir /install/weblogic/classes
fi
chown -R weblogic /install/weblogic/classes
chgrp -R weblogic /install/weblogic/classes
chmod -R 777 /install/weblogic/classes
if [ ! -d /install/weblogic/classes/Jars ]
then
mkdir /install/weblogic/classes/Jars
fi
chown -R weblogic /install/weblogic/classes/Jars
chgrp -R weblogic /install/weblogic/classes/Jars
chmod -R 777 /install/weblogic/classes/Jars
if [ ! -d /install/weblogic/servlets_logs ]
then
mkdir /install/weblogic/servlets_logs
fi
chown -R weblogic /install/weblogic/servlets_logs
chgrp -R weblogic /install/weblogic/servlets_logs
chmod -R 777 /install/weblogic/servlets_logs
if [ ! -d /install/weblogic/secured ]
then
mkdir /install/weblogic/secured
fi
chown -R weblogic /install/weblogic/secured
chgrp -R weblogic /install/weblogic/secured
chmod -R 777 /install/weblogic/secured
if [ ! -d /install/weblogic/preview ]
then
mkdir /install/weblogic/preview
fi
chown -R weblogic /install/weblogic/preview
chgrp -R weblogic /install/weblogic/preview
chmod -R 777 /install/weblogic/preview
if [ ! -d /install/weblogic/images ]
then
mkdir /install/weblogic/images
fi
chown -R weblogic /install/weblogic/images
chgrp -R weblogic /install/weblogic/images
chmod -R 755 /install/weblogic/images
if [ ! -d /install/weblogic/MgsLogFiles_new ]
then
mkdir /install/weblogic/MgsLogFiles_new
fi
chown -R weblogic /install/weblogic/MgsLogFiles_new
chgrp -R weblogic /install/weblogic/MgsLogFiles_new
chmod -R 755 /install/weblogic/MgsLogFiles_new
if [ ! -d /install/weblogic/MgsLogFiles_old ]
then
mkdir /install/weblogic/MgsLogFiles_old
fi
chown -R weblogic /install/weblogic/MgsLogFiles_old
chgrp -R weblogic /install/weblogic/MgsLogFiles_old
chmod -R 755 /install/weblogic/MgsLogFiles_old
if [ ! -d /install/weblogic/help ]
then
mkdir /install/weblogic/help
fi
chown -R weblogic /install/weblogic/help
chgrp -R weblogic /install/weblogic/help
chmod -R 755 /install/weblogic/help
if [ ! -d /install/ftp ]
then
mkdir /install/ftp
fi
if [ ! -d /install/ftp/publisher ]
then
mkdir /install/ftp/publisher
fi
chown -R weblogic /install/ftp/publisher
chgrp -R weblogic /install/ftp/publisher
chmod -R 777 /install/ftp/publisher
if [ ! -d /install/ftp/publisherlog ]
then
mkdir /install/ftp/publisherlog
fi
chown -R weblogic /install/ftp/publisherlog
chgrp -R weblogic /install/ftp/publisherlog
chmod -R 777 /install/ftp/publisherlog
chmod -R 777 /usr/local/gwa/logs
if [ ! -d /install/weblogic/myserver ]
then
mkdir /install/weblogic/myserver
chmod 755 /install/weblogic/myserver
fi
if [ ! -f /install/weblogic/myserver/access.log ]
then
touch /install/weblogic/myserver/access.log
fi
chmod 666 /install/weblogic/myserver/access.log
## Copy the java classes and the deployment files into ~weblogic/classes
cd /install/weblogic/classes
rm -rf /install/weblogic/classes/globecom
## Globecom Java classes swapped by CC.jar !!!!!! ############
#echo "Creating java classes ...."
#cp $INSDIR/JavaClasses-$RELNAME.tar.gz .
#gunzip JavaClasses-$RELNAME.tar.gz
#/usr/bin/tar xvf JavaClasses-$RELNAME.tar
#rm *.tar
if [ "$CNFN" = "prd_2" ]
then
[ ! -d /install/weblogic/classes/globecom/deploy ] && mkdir /install/weblogic/classes/globecom/deploy
[ ! -d /install/weblogic/classes/globecom/deploy ] && chown -R weblogic:weblogic /install/weblogic/classes/globecom/deploy
rm -f /install/weblogic/classes/globecom/deploy/*
cp -f $INSDIR/deploy/* /install/weblogic/classes/globecom/deploy
else
if [ ! -d /install/weblogic/classes/deploy ]
then
mkdir /install/weblogic/classes/deploy
fi
chown -R weblogic /install/weblogic/classes/deploy
chgrp -R weblogic /install/weblogic/classes/deploy
chmod -R 777 /install/weblogic/classes/deploy
rm -f /install/weblogic/classes/deploy/*
cp -f $INSDIR/deploy/* /install/weblogic/classes/deploy
fi
# Copy the Java Jar files
rm -f /install/weblogic/classes/Jars/*.jar
cp -f $INSDIR/Java/Jars/* /install/weblogic/classes/Jars
# Copy the images files
rm -f /install/weblogic/images/*
cp -f $INSDIR/images/* /install/weblogic/images
#if [ "$ISGENUITY" = "y" ]
#then
# cp -f $INSDIR/images/* /home/gin.gcin.net-http-80/docs/images
#fi
# Copy the help files
rm -f /install/weblogic/help/*
cp -f $INSDIR/help/* /install/weblogic/help
#if [ "$ISGENUITY" = "y" ]
#then
# cp -f $INSDIR/help/* /home/gin.gcin.net-http-80/docs/help
#fi
# Copy the Oracle scripts and SQL programs
if [ -d /var/Oracle ]
then
if [ -d /var/Oracle/MakeDB ]
then
rm -rf /var/Oracle/MakeDB
fi
cp -r $INSDIR/MakeDB /var/Oracle
chmod -R +x /var/Oracle/MakeDB
fi
echo "\n\n The $RELNAME release has been distributed\n"
echo "-----------------------------------------------"
## Configuration setup
if [ "$CONFSETUP" = "lcm" ]
then
ORA_SID=`su - oracle -c 'echo $ORACLE_SID'`
/public/scripts/saconf.pl $CNFNAME $ORA_SID
echo ""
echo "-------------------------------------------------------------------"
echo "Note: To reinitialize the database and its resources, run dbinit.sh"
else
if [ "$CONFSETUP" = "fes" ]
then
echo ""
echo "LCM server full name ?"
echo ""
read ANS
LCMSRVR=$ANS
/public/scripts/fessaconf.pl $CNFNAME $LCMSRVR internet
echo ""
echo "-----------------------------------------------------"
echo "Note: To reinitialize FES resources, run fesinit.sh"
else
echo "Previous version configuration files are located in "$REFDIR". Use them as reference to configuration setup"
echo "To setup the configuration files, run ConfSetupGlb.pl"
echo "If this host is LCM server: To reinitialize the DB and its resources, run dbinit.sh"
echo "If this host is FES server: To reinitialize IPACs directories, run fesinit.sh"
fi
fi
echo "-----------------------------------------------------"
exit 0