#!/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 release name
## 2. The resources directory (default is /data/var)
## Last modified: 19.7.2001
if [ $# -lt 1 ]; then
echo "Usage: $0 release-name resource-dir"
exit 1
fi
if [ $# -lt 2 ]; then
ResrcDir="/data/var" ## Default resource directory
else
ResrcDir=$2
fi
ISGENUITY="n"
hostname | grep ".genuity." > /dev/null
if [ "$?" = "0" ]
then
ISGENUITY="y"
fi
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
chown www:www /usr/local/gwa/share
chmod 777 /usr/local/gwa/share
# 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 /public/ins/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 /public/ins/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 ...."
if [ "$SYS" = "Linux" ]
then
cd /etc/rc.d/init.d
cp /public/ins/conf/GLB/wlsrv .
chmod 755 /etc/rc.d/init.d/wlsrv
else
cd /etc/init.d
cp /public/ins/conf/GLB/wlsrv .
chmod 755 /etc/init.d/wlsrv
fi
# Copy gwa shared files
echo "Copying shared files ...."
cd /usr/local/gwa/share
cp /public/ins/Share/* .
# Copy the Java Jar and classes (the IsAlive agent)
## Do not need anymore. They are under ~weblogic. Sephi/Yariv 17-may-2001
#cp -f /public/ins/IsAliveCls/ipworks.jar /usr/local/gwa/jars
#cp -f /public/ins/IsAliveCls/* /usr/local/gwa/globecom/globalsale/sda
# 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
[ ! -d $ResrcDir/zax/misc ] && mkdir $ResrcDir/zax/misc
cp /public/ins/misc/* $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
[ ! -d /install/weblogic/servlets_logs ] && mkdir /install/weblogic/servlets_logs
[ ! -d /install/weblogic/servlets_logs ] && chown -R www:www /install/weblogic/servlets_logs
[ ! -d /install/weblogic/servlets_logs ] && chmod -R 777 /install/weblogic/servlets_logs
[ ! -d /install/weblogic/secured ] && mkdir /install/weblogic/secured
[ ! -d /install/weblogic/secured ] && chown -R weblogic:weblogic /install/weblogic/secured
[ ! -d /install/weblogic/secured ] && chmod -R 755 /install/weblogic/secured
[ ! -d /install/weblogic/images ] && mkdir /install/weblogic/images
[ ! -d /install/weblogic/images ] && chown -R weblogic:weblogic /install/weblogic/images
[ ! -d /install/weblogic/images ] && chmod -R 755 /install/weblogic/images
[ ! -d /install/weblogic/help ] && mkdir /install/weblogic/help
[ ! -d /install/weblogic/help ] && chown -R weblogic:weblogic /install/weblogic/help
[ ! -d /install/weblogic/help ] && chmod -R 755 /install/weblogic/help
[ ! -d /install/ftp ] && mkdir /install/ftp
[ ! -d /install/ftp/publisher ] && mkdir /install/ftp/publisher
[ ! -d /install/ftp/publisher ] && chmod -R 777 /install/ftp/publisher
# chmod -R 755 /install/weblogic/classes/globecom/globalsale/servlets
chmod -R 777 /usr/local/gwa/logs
[ ! -d /install/weblogic/classes/Jars ] && mkdir /install/weblogic/classes/Jars
chown www:www /install/weblogic/classes/Jars
## Copy the java classes and the deployment files into ~weblogic/classes
cd /install/weblogic/classes
rm -rf /install/weblogic/classes/globecom
echo "Creating java classes ...."
cp /public/ins/JavaClasses-$RELNAME.tar.gz .
gunzip JavaClasses-$RELNAME.tar.gz
/usr/bin/tar xvf JavaClasses-$RELNAME.tar
rm *.tar
[ ! -d /install/weblogic/classes/globecom ] && chown -R weblogic:weblogic /install/weblogic/classes/globecom
# Copy the Java Jar files
rm -f /install/weblogic/classes/Jars/*.jar
cp -f /public/ins/Java/Jars/*.jar /install/weblogic/classes/Jars
# Copy the images files
rm -f /install/weblogic/images/*
cp -f /public/ins/images/* /install/weblogic/images
if [ "$ISGENUITY" = "y" ]
then
cp -f /public/ins/images/* /home/gin.gcin.net-http-80/docs/images
fi
# Copy the help files
rm -f /install/weblogic/help/*
cp -f /public/ins/help/* /install/weblogic/help
if [ "$ISGENUITY" = "y" ]
then
cp -f /public/ins/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
mkdir /var/Oracle/MakeDB
else
rm -f /var/Oracle/MakeDB/*
fi
cp -f /public/ins/MakeDB/* /var/Oracle/MakeDB
fi
echo "\n\n The $RELNAME release has been distributed\n"
echo "-----------------------------------------------"
echo "To check the configuration files, run ConfChecker.pl"
echo "To reset the configuration files, run ConfSetupGlb.pl"
echo "-----------------------------------------------"