zope install using buildout

  1. connect pendrive to pc
  2. go to erp folder in pendrive, copy erp5.sh file to (places->home folder)
  3. open terminal  and check whether that file is copied or not ie., for that type ls command in terminal($ls)
  4. run erp5.sh on termainla  ($./erp5.sh)
  5. when ever this script ask password please provide the your user password..

================


shell script



===============
erp5.sh


#!/bin/bash
red='\e[0;31m'
Green='\e[1;32m'
Blue='\e[1;34m'
NC='\e[0m' # No Color
#checking login user
if [ $(whoami) = "erp" ]
then
 echo  -e "${Green}#####################executing the code, we are the right user.##########################${NC}"
else
  echo  -e "${red}#####################You must be user 'erp' to run this script.#########################${NC}"
  exit 0
fi
sleep 3

echo -e "${Blue}######################Welcome To Bash Shell Scripting.###############################${NC}";
sudo apt-get update
#Installing dependecies
pkg=$(dpkg -s build-essential|grep installed)
echo -e "${Green}Checking for build-essential: $pkg${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install build-essential
         break
     done
   fi
pkg=$(dpkg -s build-essential|grep installed)
   while [ "" == "$pkg" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done

pkg1=$(dpkg -s libxslt1-dev|grep installed)
echo -e "${Green}Checking for libxslt1-dev: $pkg1${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg1" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install libxslt1-dev
         break
     done
   fi
pkg1=$(dpkg -s libxslt1-dev|grep installed)
   while [ "" == "$pkg1" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg2=$(dpkg -s libxml2-dev|grep installed)
echo -e "${Green}Checking for libxml2-dev: $pkg2${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg2" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install libxml2-dev
         break
     done
   fi
pkg2=$(dpkg -s libxml2-dev|grep installed)
   while [ "" == "$pkg2" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg3=$(dpkg -s libglib2.0-dev|grep installed)
echo -e "${Green}Checking for libglib2.0-dev: $pkg3${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg3" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install libglib2.0-dev
         break
     done
   fi
pkg3=$(dpkg -s libglib2.0-dev|grep installed)
   while [ "" == "$pkg3" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg4=$(dpkg -s python-dev|grep installed)
echo -e "${Green}Checking for python-dev: $pkg4${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg4" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install python-dev
         break
     done
   fi
pkg4=$(dpkg -s python-dev|grep installed)
   while [ "" == "$pkg4" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg5=$(dpkg -s libmysqlclient-dev|grep installed)
echo -e "${Green}Checking for libmysqlclient-dev: $pkg5${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg5" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install libmysqlclient-dev
         break
     done
   fi
pkg5=$(dpkg -s libmysqlclient-dev|grep installed)
   while [ "" == "$pkg5" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg6=$(dpkg -s libldap2-dev|grep installed)
echo -e "${Green}Checking for libldap2-dev: $pkg6${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg6" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install libldap2-dev
         break
     done
   fi
pkg6=$(dpkg -s libldap2-dev|grep installed)
   while [ "" == "$pkg" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg7=$(dpkg -s libsasl2-dev|grep installed)
echo -e "${Green}Checking for libsasl2-dev: $pkg7${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg7" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install libsasl2-dev
         break
     done
   fi
pkg7=$(dpkg -s libsasl2-dev|grep installed)
   while [ "" == "$pkg7" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg8=$(dpkg -s libssl-dev|grep installed)
echo -e "${Green}Checking for libssl-dev: $pkg8${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg8" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install libssl-dev
         break
     done
   fi
pkg8=$(dpkg -s libssl-dev|grep installed)
   while [ "" == "$pkg8" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg9=$(dpkg -s libsvn-dev|grep installed)
echo -e "${Green}Checking for libsvn-dev: $pkg9${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg9" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install libsvn-dev
         break
     done
   fi
pkg9=$(dpkg -s libsvn-dev|grep installed)
   while [ "" == "$pkg9" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg10=$(dpkg -s zlib1g-dev|grep installed)
echo -e "${Green}Checking for zlib1g-dev: $pkg10${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg10" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install zlib1g-dev
         break
     done
   fi
pkg10=$(dpkg -s zlib1g-dev|grep installed)
   while [ "" == "$pkg10" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg11=$(dpkg -s zlibc|grep installed)
echo -e "${Green}Checking for zlibc: $pkg11${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg11" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install zlibc
         break
     done
   fi
pkg11=$(dpkg -s zlibc|grep installed)
   while [ "" == "$pkg11" ]; do
     if [ i==1 ]; then
       echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
pkg12=$(dpkg -s subversion|grep installed)
echo -e "${Green}Checking for subversion: $pkg${NC}"
for ((i=0; i<2; i++)); do
  if [ i==0 ]; then
    while [ "" == "$pkg12" ]; do
      echo "Not installed its going to  install "
      sudo apt-get --force-yes --yes install subversion
         break
     done
   fi
pkg12=$(dpkg -s subversion|grep installed)
   while [ "" == "$pkg12" ]; do
     if [ i==1 ]; then
           echo -e "${red}########Internet Problem Please Check Your Network Connection And Re-Run This Script Again#########${NC}"
           exit
     fi
  done
done
#sudo apt-get install build-essential libxslt-dev libxml2-dev libglib2.0-dev python-dev libmysqlclient-dev libldap2-dev libsasl2-dev libssl-dev libsvn-dev zlib1g-dev zlibc subversion
#echo "Sucessfully Installed Dependency Packages"
#creating erp5 and erp5instance in erp user
cd /home/erp
sudo tar -xvf /media/LIVE/erp5.tar.bz2

if [ -d erp5 ]
then
    echo -e "${Blue}#################"ERP5" is created & starting to create "ERP5INSTANCE".#####################${NC}"
else
    echo -e "${red}#########Yikes! "ERP5" is not Created! Please check wether "erp5.tar.bz2" file is avialable in media###########${NC}"
exit
fi

sudo tar -xvf /media/LIVE/erp5instance.tar.bz2
if [ -d erp5instance ]
then
    echo -e "${Blue}######################"ERP5INSTANCE" is created.#################################${NC}"
else
    echo -e "${red}###############Yikes! "ERP5INSTANCE" is not created! Please check wether "erp5instance.tar.bz2" file is available in media################${NC}"
exit
fi
ps cax | grep python2.4> /dev/null
if [ $? -eq 0 ]; then
  echo "Process is running."
sudo  kill -9 $(pidof python2.4)
else
  echo "Process is not running."
fi
ps cax | grep mysqld> /dev/null
if [ $? -eq 0 ]; then
  echo "Process is running."
sudo  kill -9 $(pidof mysqld)
else
  echo "Process is not running."
fi
#kill -9 $(pidof python2.4)
#kill -9 $(pidof mysqld)
#starting erp5 instance
echo -e "${Blue}############################Starting Erp5 Instance#################################${NC}";
/home/erp/erp5instance/bin/supervisord

echo -e "${Green}#######################Please wait a while starting to configure cusat web site####################################${NC}"
sleep 40

#####installing apache and sendmail server

sudo apt-get --force-yes --yes install apache2 squid sendmail
#enabling rewrite and proxy rules in apache server
sudo a2enmod rewrite
sudo a2enmod proxy
sudo a2enmod proxy_http
#restrating service
sudo /etc/init.d/apache2 restart
#configuring cusat site
rm -rf /etc/apache2/sites-available/cusat.com
#cat > /etc/apache2/sites-available/cusat.com
echo "<VirtualHost *:80>" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo "ServerName        49.206.58.242" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo "RewriteLog        /var/log/apache2/rewrite.log" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo "RewriteLogLevel   3" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo "RewriteEngine     On" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo "RewriteRule       ^/(.*) http://localhost:18080/VirtualHostBase/http/49.206.58.242/erp5/cusat/Cusat-Home/home/VirtualHostRoot/$1 [L,P]"  | sudo tee -a  /etc/apache2/sites-available/cusat.com
echo  "" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo  "<Proxy *>" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo  "Order deny,allow" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo  "Allow  from all" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo  "</Proxy>"  | sudo tee -a /etc/apache2/sites-available/cusat.com
echo "" | sudo tee -a /etc/apache2/sites-available/cusat.com
echo  "</VirtualHost>" | sudo tee -a /etc/apache2/sites-available/cusat.com
sudo a2ensite cusat.com
sudo /etc/init.d/apache2 restart
clear
echo "######################################################################################################################"
echo ""
echo ""
echo ""
echo ""
echo ""
echo -e "${Blue}"ERP5" INSTALLATION IS SUCESSFULLY COMPLEATED.${NC}"
echo ""
echo ""
echo ""
echo ""
echo ""
echo -e "${Blue}Connecting to Zope Management Interface Page.${NC}";
echo ""
echo ""
echo ""
echo ""
echo ""
echo "######################################################################################################################"

sleep 15
firefox "http://127.0.0.1:18080" &

No comments:

Post a Comment