#!/bin/sh
#########################################################################
# A script to install External tools on Globecom servers.
# Installs RealServer, snmp, xerces, Apache and Jserv according to the
# server type.
# One input parameter is received: the server's type GIN, APP
# or StandAlone.
#########################################################################
# Written by Nissim Mimran
# Date 10/09/2001
#########################################################################
clear
################## yes/no procedure ##################################
Yes_No (){
echo "Your Choice [y/n]: ->\c "
while :
do
read select
case "$select" in
# yes
[yY]*)
ANS=1
return
;;
# no
[nN]*)
ANS=0
return
;;
# nothing
*)
echo " Please type Y/y or N/n"
;;
esac
done
}
####################### string check ####################################
Var_Check() {
## check groups/user existence
while [ $char = 0 ] ;
do
grep $F_VAR $F_CHK >/dev/null 2>&1
if [ $? = 0 ] ; then
F_VAR=`expr $F_VAR + 1`
else
char=1
y=0
fi
done
}
######################### installation procedure ########################
Install_pkg() {
/bin/rm -rf /tmp/pkgtmp >/dev/null 2>&1
mkdir /tmp/pkgtmp
cp $pkg /tmp/pkgtmp
cd /tmp/pkgtmp
/usr/local/bin/gunzip $pkg
echo "" | pkgadd -d *local
cd $PKG_DIR
/bin/rm -rf /tmp/pkgtmp >/dev/null 2>&1
}
####################### check/create /usr/local #########################
Install_Packs() {
## check /usr/local/ directory
if [ ! -d /usr/local ] ; then
mkdir -p /usr/local
chmod -R 755 /usr/local
fi
## check/install gzip
pkginfo -i | grep -i gzip >/dev/null 2>&1
if [ $? = 1 ] ; then
echo "" | pkgadd -d gzip*local
echo " gzip not installed"
else
echo " gzip is installed"
fi
## check installation of other paks
for pkg in *local.gz ; do
PK=`echo $pkg | awk -F- '{ print $1}' `
pkginfo -i |grep -i $PK >/dev/null 2>&1
if [ $? = 1 ] ; then
Install_pkg
fi
done
}
####################### installation of apache ##########################
Install_Apache() {
echo " Installing Apache ... "
sleep 3
VER=`uname -a|awk '{print $6}'`
if [ $VER = "sparc" ]
then
echo "This is sparc machine"
# Stronghold Apache installation - not in use
# $Work_dir/sol7_intel/applic/sh-30-sparc-sun-solaris2.7.bc3014
else
echo "This is Intel machine"
# Stronghold Apache installation - not in use
# $Work_Dir/sol8_intel/applic/sh-30-i386-unknown-solaris2.8.bc3014
fi
echo " Apache installation completed. Press any key...."
cd $Work_dir
read i
clear
}
####################### installation of java ####################
Install_JavaApps() {
echo " Installing jdk 1.2.1... "
sleep 2
VER=`uname -a|awk '{print $6}'`
if [ $VER = "sparc" ] ;
then
{
cp $Work_Dir/applic/jdk-1_2_1_004-solsparc.sh /usr/local
cd /usr/local/
./jdk-1_2_1_004-solsparc.sh
rm jdk-1_2_1_004-solsparc.sh
}
else
{
cp $Work_Dir/sol8_intel/applic/jdk-1_2_1_004-solx86.sh /usr/local
cd /usr/local
./jdk-1_2_1_004-solx86.sh
rm jdk-1_2_1_004-solx86.sh
}
fi
echo " Installing Jsdk... "
sleep 2
cp $Work_Dir/applic/jsdk20-solaris2-sparc.tar.Z /usr/local
cd /usr/local
uncompress jsdk20-solaris2-sparc.tar.Z
tar xvf jsdk20-solaris2-sparc.tar
rm jsdk20-solaris2-sparc.tar
echo " Java and Jserv installation completed. Press any key ... "
cd $Work_Dir
read i
clear
}
#################### installation of ApacheJserv #########################
Instal_ApacheJ() {
echo " Apache Jserv installation ..."
sleep 2
cp $Work_Dir/applic//ApacheJServ-1.1.2.tar /usr/local
tar xvf ApacheJServ-1.1.2.tar
cd ApacheJServ-1.1.2
./configure --with-apxs=/usr/local/apache/bin/apxs
make
make install
cd ..
rm ApacheJServ-1.1.2.tar
echo " Apache Jserv installation completed. Press any key ... "
cd $Work_Dir
read i
clear
}
####################### installation of snmp #############################
Install_snmp() {
echo " Installing snmp ... "
sleep 3
cp $Work_Dir/applic/ucd-snmp-current.tar /usr/local
cd /usr/local
tar xvf ucd-snmp-current.tar
rm ucd-snmp-current.tar
cd ucd-snmp-snapshot
./configure --sysconfdir=/etc --prefix=/usr --with-mib-modules="agentx ucd-snmp/dlmod"
make
make install
echo " snmp installation completed. Press any key ... "
cd $Work_Dir
read i
clear
}
####################### installation of xcerces ##########################
Install_xerces() {
echo " Installing xerces ... "
sleep 3
cp $Work_Dir/applic/Xerces-C-src_1_2_0a.tar /usr/local
cd /usr/local
tar xvf Xerces-C-src_1_2_0a.tar
rm Xerces-C-src_1_2_0a.tar
cd xerces-c-src_1_2_0
XERCESCROOT=/usr/local/xerces-c-src_1_2_0
export XERCESCROOT
cd src
chmod +x *figure
./runConfigure -p solaris -x g++ -c gcc
make
make install
cd ../include
cp -r * /usr/include
echo " Dont forget to add variable to cshrc file XERCESCROOT path"
echo " xerces installation completed. Press any key ... "
cd $Work_Dir
read i
clear
}
####################### installation of Real server ######################
Install_Realserver() {
VER=`uname -a|awk '{print $6}'`
if [ $VER = "sparc" ] ;
then
{
echo " Installing RealServer ... "
./applic/rs8-0-solaris-27.bin
echo " RealServer installation completed. Press any key ... "
read ANS
}
else
{
echo " There is not RealServer Installer for intel-solaris. Press any key ... "
read ANS
}
fi
}
####################### Weblogic installation ############################
Install_Weblogic() {
JDK_DIR=/usr/local/jdk1.2.1
clear
echo " Installing Weblogic-v5.1 ..."
# check if jdk and jsdk are on the system
if [ ! -d $JDK_DIR ] ; then
{
echo " You do not have jdk-1.2.1 installed on your system."
echo " Please install it from Manual menu."
echo " Press Enter to go back ..."
read i
clear
return
}
fi
echo " Here is the free disk space on your system :"
echo""
df -k
echo ""
Weblogic_Ins=/install/weblogic
cd $weblogdir
cat << EOI
Now the installation check if user/group weblogic exist
and if not create them.
EOI
sleep 2
ypcat passwd | grep "^weblogic:" >/dev/null 2>&1
if [ $? != 0 ]
then
grep weblogic /etc/passwd >/dev/null 2>&1
if [ $? != 0 ]
then
F_VAR=1010
F_CHK=/etc/passwd
Var_Check
useradd -d /install/weblogic -g $F_VAR weblogic
fi
fi
ypcat group | grep "^weblogic:" >/dev/null 2>&1
if [ $? != 0 ]
then
grep weblogic /etc/group >/dev/null 2>&1
if [ $? != 0 ]
then
F_VAR=100
F_CHK=/etc/group
Var_Check
/usr/sbin/groupadd -g $F_VAR weblogic
fi
fi
cd /install/weblogic
cd ..
cp $Work_Dir/weblogic/weblogic51.zip .
unzip weblogic51.zip
chmod -R +x weblogic
chown -R weblogic:weblogic weblogic
cd /tmp
cp $Work_Dir/weblogic/weblogic510sp10.tar.gz .
gunzip weblogic510sp10.tar.gz
tar xvf weblogic510sp10.tar
cd /install/weblogic
cp -r /tmp/weblogic5.1SP10/* .
cd ..
chmod -R +x weblogic
chown -R weblogic:weblogic weblogic
rm -f /tmp/weblogic510sp10.tar.gz
rm -rf /tmp/weblogic5.1SP10
## weblogic license install
echo " do you want to install Weblogic license ?"
Yes_No
if [ $ANS = 1 ]; then
echo " Where is the new license placed ?\c"
read Lic_Dir
cd ~weblogic/license
cp WebLogicLicense.xml WebLogicLicense.xml.`date '+%m.%d.%y'`
cp $Lic_Dir/WebLogicLicense.xml .
else
echo " Rememeber that you need the license to make Weblogic work !!"
fi
}
####################### StandAlone installation ##########################
StandAlone_install() {
echo " stand alone install here...."
read i
return
}
####################### Menual installation ##############################
Menual_install(){
clear
banner " Manual"
banner " Setup"
cat << EOI
(1). Packages
(2). Xerces
(3). Snmp
(4). Jdk + Jsdk
(5). Apache Stronghold
(6). Apache Jserv
(7). RealServer
(8). Weblogic
(0). Back to main menu.
Notice: Follow this order to install system manually !!
EOI
echo "Your Choice: ->\c "
while :
do
read select
case "$select" in
# packages
[1]*)
Install_Packs
;;
# Xcerces
[2]*)
Install_xerces
Menual_install
;;
# Snmp
[3]*)
Install_snmp
Menual_install
;;
# Jdk + snmp
[4]*)
Install_JavaApps
Menual_install
;;
# Apache
[5]*)
Install_Apache
Menual_install
;;
# Apache Jserv
[6]*)
Install_ApacheJ
Menual_install
;;
# RealServer
[7]*)
Install_Realserver
Menual_install
;;
# WebLogic
[8]*)
Install_Weblogic
Menual_install
;;
# Back to main menu
[0]*)
Main_script
;;
# Nothing
*)
echo " Please [1-8] or [0] to go back. "
;;
esac
done
}
#################### Main script #########################################
Main_script(){
clear
banner " Globecom"
banner " Setup"
cat << EOI
(G)Gin - Install GIN and WEB server.
(A)App - Install Application server.
(S)StandAlone - StandAlone installation.
(M)manual - Manual installation.
(Q)quit - End of working.
EOI
echo " Your Choice: ->\c "
while :
do
read select
case "$select" in
# Gin server
[gG]*)
echo " GIN Server installation "
Install_xerces
Install_snmp
Install_JavaApps
Install_Apache
Install_ApacheJ
return
;;
# Application server
[aA]*)
echo " Application Server installation "
Install_JavaApps
Install_Apache
Install_ApacheJ
;;
# StandAlone Installation
[sS]*)
StandAlone_install
;;
# Manual Installation
[mM]*)
Menual_install
;;
# End working
[qQ]*)
exit 1
;;
# Nothing
*)
echo " Please type G/g or A/a or M/a or S/s or Q/q for end "
;;
esac
done
}
####################
### Main script ### #####################################################
####################
########################### system variabels #############################
Work_Dir=`pwd`
if [ ! -d sol7_sparc -o ! -d sol8_intel -o ! -d weblogic ]
then
echo ""
echo "Incorrect directory. Please cd to installation root dir"
echo ""
exit 1
fi
s8pk=$Work_Dir/sol8_intel/packs/ # intel solaris 8 paks directory
s7pk=$Work_Dir/sol7_sparc/packs/ # sparc solaris 7 paks directory
weblogdir=$Work_Dir/weblogic # weblogic installation files
F_VAR=1
F_CHK=/etc/group
char=0
y=1
#########################################################################
clear
banner " Globecom"
banner " Software"
cat << EOF
Welcome to Globecom Interactive system installation.
You must be root user to continue !
Press Enter to continue...
EOF
read i
## root check
/usr/bin/id | grep -w 'uid=0' >/dev/null 2>&1
if [ $? != 0 ] ; then
echo "Sorry ! you must be root to continue"
echo "bye."
exit 1
else
echo "You are root user "
echo "Lets start .."
sleep 1
fi
Main_script