Skip to content

Commit

Permalink
cpsupdate: removed old script and updated the default ip
Browse files Browse the repository at this point in the history
  • Loading branch information
tcrivat committed Jul 21, 2016
1 parent 87a3879 commit 7676168
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 138 deletions.
66 changes: 35 additions & 31 deletions cpsupdate.sh
Original file line number Diff line number Diff line change
@@ -1,93 +1,97 @@
#!/bin/bash

# supported_comps=('director' 'manager' 'lib' 'tools' 'frontend')
CPSVERSION="100"
director="cpsdirector-$CPSVERSION.tar.gz"
manager="ConPaaS-$CPSVERSION.tar.gz"
CPSVERSION="2.0.0"
director="cpsdirector-$CPSVERSION.tar.gz"
manager="ConPaaS-$CPSVERSION.tar.gz"
lib="cpslib-$CPSVERSION.tar.gz"
tools="cps-tools-$CPSVERSION.tar.gz"
frontend="cpsfrontend-$CPSVERSION.tar.gz"

taballs=""

IP_PREFIX=192.168.13
# IP_PREFIX=192.168.13
IP_ADDRESS=192.168.56.2

rm -f *$CPSVERSION*.tar.gz

./mkdist.sh $CPSVERSION "$@"
./mkdist.sh $CPSVERSION "$@"

# TMPFILE=$(mktemp)
TMPFILE='/tmp/cpsinstall'

cat <<EOT >> $TMPFILE
#!/bin/bash
IP_ADDRESS="\$(ip addr show | perl -ne 'print "\$1\n" if /inet ([\d.]+).*scope global/' | grep "$IP_PREFIX" | head -1)"
IP_ADDRESS=$IP_ADDRESS
#IP_ADDRESS="\$(ip addr show | perl -ne 'print "\$1\n" if /inet ([\d.]+).*scope global/' | grep "$IP_PREFIX" | head -1)"
#DIRECTOR_URL="https://\${IP_ADDRESS}:5555"
#echo \$DIRECTOR_URL
EOT

ls $lib > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
sudo rm -r /usr/local/lib/python2.7/dist-packages/cpslib-*-py2.7.egg/
sudo easy_install cpslib-*.tar.gz
rm cpslib-*.tar.gz
EOT
taballs+="$lib "
}


ls $director > /dev/null 2>&1 &&
ls $director > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
echo "#installing director"
#cp /etc/cpsdirector/director.cfg .
rm -rf /usr/local/lib/python2.7/dist-packages/cpsdirector-*-py2.7.egg
sudo rm -rf /usr/local/lib/python2.7/dist-packages/cpsdirector-*-py2.7.egg
tar -xaf cpsdirector-*.tar.gz
rm -f cpsdirector-*.tar.gz
cd cpsdirector-*
echo \$IP_ADDRESS | make install
cd cpsdirector-*
echo \$IP_ADDRESS | sudo make install
cd ..
rm -rf cpsdirector-*
sudo rm -rf cpsdirector-*
#mv director.cfg /etc/cpsdirector/
sqlite3 /etc/cpsdirector/director.db 'delete from resource; delete from service'
service apache2 restart
sudo sqlite3 /etc/cpsdirector/director.db 'delete from resource; delete from service'
sudo service apache2 restart
EOT
taballs+="$director "
}

ls $manager > /dev/null 2>&1 &&
ls $manager > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
mv $manager /etc/cpsdirector/ConPaaS.tar.gz
EOT
taballs+="$manager "
}

ls $lib > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
rm -r /usr/local/lib/python2.7/dist-packages/cpslib-*-py2.7.egg/
easy_install cpslib-*.tar.gz
rm cpslib-*.tar.gz
EOT
taballs+="$lib "
}

ls $tools > /dev/null 2>&1 &&
ls $tools > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
rm -rf /usr/local/lib/python2.7/dist-packages/cps_tools/
sudo rm -rf /usr/local/lib/python2.7/dist-packages/cps_tools/
tar xaf cps-tools*
cd cps-tools-*
./configure --sysconf=/etc
make install
sudo make install
#mkdir -p $HOME/.conpaas
cps-user get_certificate
cd ..
rm -rf cps-tools*
sudo rm -rf cps-tools*
EOT
taballs+="$tools "
}


ls $frontend > /dev/null 2>&1 &&
ls $frontend > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
tar -xaf cpsfrontend*.tar.gz
rm cpsfrontend*.tar.gz
cp -r cpsfrontend-*/www/* /var/www/html/
sudo cp -r cpsfrontend-*/www/* /var/www/
rm -rf cpsfrontend*
EOT
taballs+="$frontend "
Expand All @@ -102,4 +106,4 @@ scp $TMPFILE $taballs conpaas:
ssh conpaas 'bash cpsinstall; rm cpsinstall'
# ssh conpaas 'cat cpsinstall; rm cpsinstall'

rm -f ${TMPFILE}
rm -f ${TMPFILE}
107 changes: 0 additions & 107 deletions cpsupdate_nutshell.sh

This file was deleted.

0 comments on commit 7676168

Please sign in to comment.