#!/bin/sh
## A Script to collect compiled binaries and libraries on the integration machine.
## Everything is collected into tar files, to be passed on to the system test machine.
## Two input parameters are required:
## 1. The location of the root of the compilation tree
## 2. The release name
##
## A default tar is made for a Solaris SUN machine. Additional versions are copied from the
## root directory by adding a -LNX suffix for Linux and -INTL for Intel-Solaris.
#
## If GIN-LNX (for Linux) or GIN-INTL (for Intel-Solaris) directories are not found, the
## collection of the missing version is skipped.
##
## In addition, the Java classes files - prodcuts of CC build, and many data files (html, jars)
## are also copy.
if [ $# -lt 3 ]
then
echo ""
echo "Usage: $0 dir build-name configuration-name"
echo "Example: $0 ~cmadm/p4client/Globecom/prd_2.0/Globecom/GIN Build1.8.8 prd_2.0"
echo ""
exit 1
fi
RELDIR=$1
if [ ! -d $RELDIR ]
then
echo ""
echo $RELDIR" is not exist. Exit..."
echo ""
exit 1
fi
CNFNAME=$3
INSDIR="/public/"$CNFNAME"/ins"
if [ ! -d $INSDIR ]
then
echo ""
echo $INSDIR" is not exist. Exit..."
echo ""
exit 1
fi
SCRIPTSINSDIR="/public/"$CNFNAME"/scripts"
RELNAME=Rel-$2
RELDIRLNX=$RELDIR-LNX
RELDIRINTL=$RELDIR-INTL
SCRIPTSDIR="/public/scripts"
CONFDIR=$INSDIR"/conf/GLB"
#SHAREDIR=$INSDIR"/Share"
CNFN=`echo $CNFNAME | awk -F. '{print $1}'`
RRDIR=`echo $RELDIR | sed 's?/GIN??'`
RRCONFDIR=$RRDIR"/public/ins/conf/GLB"
#RRSHAREDIR=$RRDIR"/public/ins/Share"
if [ -d $CONFDIR ]
then
rm -f $CONFDIR/*
else
mkdir -p $CONFDIR
fi
cp $RRCONFDIR/* $CONFDIR
#if [ -d $SHAREDIR ]
#then
# rm -f $SHAREDIR/*
#else
# mkdir -p $SHAREDIR
#fi
#cp $RRSHAREDIR/* $SHAREDIR
# Copy the executables to /tmp/bin-release *******************
echo "\n Collecting binaries from $RELDIR ....\n"
if [ -d /tmp/bin-release ]; then
# Clean up old files
rm -rf /tmp/bin-release/*
else
# Create directory
mkdir /tmp/bin-release
fi
cd /tmp/bin-release
# Start copying binaries
echo " Copying binaries ...."
#cp $RELDIR/SDA/sdad .
#cp $RELDIR/SDU/sdud .
#cp $RELDIR/NPDD/Npdd .
#cp $RELDIR/LSM/Lsm .
cp $RELDIR/Z2H/XmlConvertor .
#cp $RELDIR/GTL/setconf .
#cp $RELDIR/GTL/snmpconf .
#cp $RELDIR/GTL/http .
#cp $SCRIPTSDIR/isalive.sh .
#cp $CONFDIR/startIsAlive.sh .
cp $CONFDIR/startTrapsFilter.sh .
cp $CONFDIR/startFES.sh .
#cp $CONFDIR/sdad.sh .
#cp $CONFDIR/sdud.sh .
#cp $CONFDIR/Npdd.sh .
# Tar the content of the directory
rm -f $INSDIR/Bin-SUN-$RELNAME.tar.gz
/usr/bin/tar cvf $INSDIR/Bin-SUN-$RELNAME.tar .
gzip $INSDIR/Bin-SUN-$RELNAME.tar
# Repeat for Linux, if build exists
if [ -d $RELDIRLNX ]; then
echo "\n Collecting binaries from $RELDIRLNX ....\n"
rm -rf /tmp/bin-release/*
# cp $RELDIRLNX/SDA/sdad .
# cp $RELDIRLNX/SDU/sdud .
# cp $RELDIRLNX/NPDD/Npdd .
# cp $RELDIRLNX/LSM/Lsm .
cp $RELDIRLNX/Z2H/XmlConvertor .
# cp $RELDIRLNX/GTL/setconf .
# cp $RELDIRLNX/GTL/snmpconf .
# cp $RELDIRLNX/GTL/http .
# cp $SCRIPTSDIR/isalive.sh .
# cp $CONFDIR/startIsAlive.sh .
cp $CONFDIR/startTrapsFilter.sh .
cp $CONFDIR/startFES.sh .
# cp $CONFDIR/sdad.sh .
# cp $CONFDIR/sdud.sh .
# cp $CONFDIR/Npdd.sh .
# Tar the content of the directory
rm -f $INSDIR/Bin-LNX-$RELNAME.tar.gz
/usr/bin/tar cvf $INSDIR/Bin-LNX-$RELNAME.tar .
gzip $INSDIR/Bin-LNX-$RELNAME.tar
fi
# Repeat for Intel-Solaris, if build exists
if [ -d $RELDIRINTL ]; then
echo "\n Collecting binaries from $RELDIRINTL ....\n"
rm -rf /tmp/bin-release/*
# cp $RELDIRINTL/SDA/sdad .
# cp $RELDIRINTL/SDU/sdud .
# cp $RELDIRINTL/NPDD/Npdd .
# cp $RELDIRINTL/LSM/Lsm .
cp $RELDIRINTL/Z2H/XmlConvertor .
# cp $RELDIRINTL/GTL/setconf .
# cp $RELDIRINTL/GTL/snmpconf .
# cp $RELDIRINTL/GTL/http .
# cp $SCRIPTSDIR/isalive.sh .
# cp $CONFDIR/startIsAlive.sh .
cp $CONFDIR/startTrapsFilter.sh .
cp $CONFDIR/startFES.sh .
# cp $CONFDIR/sdad.sh .
# cp $CONFDIR/sdud.sh .
# cp $CONFDIR/Npdd.sh .
# Tar the content of the directory
rm -f $INSDIR/Bin-INTL-$RELNAME.tar.gz
/usr/bin/tar cvf $INSDIR/Bin-INTL-$RELNAME.tar .
gzip $INSDIR/Bin-INTL-$RELNAME.tar
fi
# Cleanup
rm -rf /tmp/bin-release/*
# Copy the libraries to /tmp/lib-release *****************************
if [ -d /tmp/lib-release ]; then
# Clean up old files
rm -rf /tmp/lib-release/*
else
# Create directory
mkdir /tmp/lib-release
fi
cd /tmp/lib-release
# Start copying libraries
echo "\n Collecting libraries from $RELDIR ....\n"
#cp $RELDIR/DPT/lib*.so .
#cp $RELDIR/GNS/*.so .
cp $RELDIR/GTL/lib*.so .
#cp $RELDIR/GRB/lib*.so .
#cp $RELDIR/RUS/lib*.so .
#cp $RELDIR/PICI/lib*.so .
#cp $RELDIR/SDA/lib*.so .
#cp $RELDIR/ZAX/lib*.so .
#cp $RELDIR/SDU/lib*.so .
#cp $RELDIR/UWS/*.so .
# Create version suffix
for libr in `ls *.so`; do
mv $libr $libr.0
ln -s $libr.0 $libr
done
# Tar the content of the directory
rm -f $INSDIR/Lib-SUN-$RELNAME.tar.gz
/usr/bin/tar cvf $INSDIR/Lib-SUN-$RELNAME.tar .
gzip $INSDIR/Lib-SUN-$RELNAME.tar
# Clean up
rm -rf /tmp/lib-release/*
# Repeat for Linux, if build exists
if [ -d $RELDIRLNX ]; then
# Start copying libraries
echo "\n Collecting libraries from $RELDIRLNX ....\n"
# cp $RELDIRLNX/DPT/lib*.so .
# cp $RELDIRLNX/GNS/*.so .
cp $RELDIRLNX/GTL/lib*.so .
# cp $RELDIRLNX/GRB/lib*.so .
# cp $RELDIRLNX/RUS/lib*.so .
# cp $RELDIRLNX/PICI/lib*.so .
# cp $RELDIRLNX/SDA/lib*.so .
# cp $RELDIRLNX/ZAX/lib*.so .
# cp $RELDIRLNX/SDU/lib*.so .
# cp $RELDIRLNX/UWS/*.so .
# Create version sufix
for libr in `ls *.so`; do
mv $libr $libr.0
ln -s $libr.0 $libr
done
# Tar the content of the directory
rm -f $INSDIR/Lib-LNX-$RELNAME.tar.gz
/usr/bin/tar cvf $INSDIR/Lib-LNX-$RELNAME.tar .
gzip $INSDIR/Lib-LNX-$RELNAME.tar
fi
# Clean up
rm -rf /tmp/lib-release/*
# Repeat for Intel-Solaris, if build exists
if [ -d $RELDIRINTL ]; then
# Start copying libraries
echo "\n Collecting binaries and libraries from $RELDIRINTL ....\n"
# cp $RELDIRINTL/DPT/lib*.so .
# cp $RELDIRINTL/GNS/*.so .
cp $RELDIRINTL/GTL/lib*.so .
# cp $RELDIRINTL/GRB/lib*.so .
# cp $RELDIRINTL/RUS/lib*.so .
# cp $RELDIRINTL/PICI/lib*.so .
# cp $RELDIRINTL/SDA/lib*.so .
# cp $RELDIRINTL/ZAX/lib*.so .
# cp $RELDIRINTL/SDU/lib*.so .
# cp $RELDIRINTL/UWS/*.so .
# Create version sufix
for libr in `ls *.so`; do
mv $libr $libr.0
ln -s $libr.0 $libr
done
# Tar the content of the directory
rm -f $INSDIR/Lib-INTL-$RELNAME.tar.gz
/usr/bin/tar cvf $INSDIR/Lib-INTL-$RELNAME.tar .
gzip $INSDIR/Lib-INTL-$RELNAME.tar
fi
## CC files copying procedure
echo "Copy MakeDB files to installation directory"
if [ -d $INSDIR/MakeDB ]
then
rm -rf $INSDIR/MakeDB/*
else
mkdir -p $INSDIR/MakeDB
fi
cp -r $RRDIR/globalsale/db/* $INSDIR/MakeDB
echo "Copy Jar files to installation directory"
if [ -d $INSDIR/Java/Jars ]
then
rm -f $INSDIR/Java/Jars/*
else
mkdir $INSDIR/Java/Jars
fi
cp $RRDIR/jars/* $INSDIR/Java/Jars
cp $RRDIR/classes/lib/Admin.jar $INSDIR/Java/Jars
echo "Copy image files to installation directory"
if [ -d $INSDIR/images ]
then
rm -f $INSDIR/images/*
else
mkdir $INSDIR/images
fi
cp $RRDIR/html/images/* $INSDIR/images
echo "Copy help files to installation directory"
if [ -d $INSDIR/help ]
then
rm -f $INSDIR/help/*
else
mkdir $INSDIR/help
fi
cp $RRDIR/html/help/* $INSDIR/help
echo "Copy Admin.html and Cancel.html to installation directory"
rm -f $INSDIR/conf/GLB/Admin.html* $INSDIR/conf/GLB/Cancel.html
cp $RRDIR/html/*.html* $INSDIR/conf/GLB
echo "Copy Java classes to installation directory"
rm -rf $INSDIR/Java/globecom
mkdir $INSDIR/Java/globecom
cp -r $RRDIR/classes/globecom/globalsale $INSDIR/Java/globecom
if [ "$CNFN" = "prd_2" ]
then
echo "Copy *DD.ser files to installation directory"
rm -rf $INSDIR/deploy
mkdir $INSDIR/deploy
for i in `find $RRDIR/classes/globecom/globalsale -name "*DD.ser"`
do
cp $i $INSDIR/deploy
done
else
echo "Copy deployment JAR files to installation directory"
rm -rf $INSDIR/deploy
cp -r $RRDIR/classes/deploy $INSDIR
fi
echo "Copy Java applets to EPOP installation directory"
EPOPINSDIR=$INSDIR"/EPOP-Source/classpath/globecom/globalsale/applets"
rm -rf $EPOPINSDIR
mkdir -p $EPOPINSDIR
cp $RRDIR/classes/globecom/globalsale/applets/* $EPOPINSDIR
echo "Copy sounder classes into misc installation directory"
MISCINSDIR=$INSDIR/misc
SOUNDERDIR=$RRDIR/classes/globecom/globalsale/applets
rm -f $MISCINSDIR/*.class
for i in Sounder Local
do
cp $SOUNDERDIR/*.class $MISCINSDIR
done
echo "Copy files to CI intermediate directory"
CIINSDIR=$INSDIR"/CI"
CISOUNDERDIR=$CIINSDIR/classes/globecom/globalsale/applets
mkdir -p $CISOUNDERDIR
for i in Sounder Local
do
cp $SOUNDERDIR/*.class $CISOUNDERDIR
done
echo "Copy public scripts to scripts directory"
rm -rf $SCRIPTSINSDIR
cp -r /public/scripts $SCRIPTSINSDIR
echo "Copy PC-Winodws-standalone-installation document to installation directory"
rm -f $INSDIR/PC_WIN_standalone_installation.doc
cp $RRDIR/PC_WIN_standalone_installation.doc $INSDIR
# Clean up
rm -rf /tmp/lib-release/*
echo "\n\n The $RELNAME release is ready for distribution"