diff --git a/cpsupdate.sh b/cpsupdate.sh index d63b992e..e03991ac 100755 --- a/cpsupdate.sh +++ b/cpsupdate.sh @@ -1,54 +1,65 @@ #!/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 <> $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 <> $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 <> $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 <> $TMPFILE mv $manager /etc/cpsdirector/ConPaaS.tar.gz @@ -56,38 +67,31 @@ EOT taballs+="$manager " } -ls $lib > /dev/null 2>&1 && -{ -cat <> $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 <> $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 <> $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 " @@ -102,4 +106,4 @@ scp $TMPFILE $taballs conpaas: ssh conpaas 'bash cpsinstall; rm cpsinstall' # ssh conpaas 'cat cpsinstall; rm cpsinstall' -rm -f ${TMPFILE} \ No newline at end of file +rm -f ${TMPFILE} diff --git a/cpsupdate_nutshell.sh b/cpsupdate_nutshell.sh deleted file mode 100755 index 8f17a259..00000000 --- a/cpsupdate_nutshell.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash - -# supported_comps=('director' 'manager' 'lib' 'tools' 'frontend') -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=172.16.0 - -rm -f *$CPSVERSION*.tar.gz - -./mkdist.sh $CPSVERSION "$@" - -TMPFILE='/tmp/cpsinstall' - -cat <> $TMPFILE -#!/bin/bash - -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 <> $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 && -{ -cat <> $TMPFILE -echo "#installing director" -#cp /etc/cpsdirector/director.cfg . -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 | sudo make install -cd .. -sudo rm -rf cpsdirector-* -#mv director.cfg /etc/cpsdirector/ -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 && -{ -cat <> $TMPFILE -mv $manager /etc/cpsdirector/ConPaaS.tar.gz -EOT -taballs+="$manager " -} - - -ls $tools > /dev/null 2>&1 && -{ -cat <> $TMPFILE -sudo rm -rf /usr/local/lib/python2.7/dist-packages/cps_tools/ -tar xaf cps-tools* -cd cps-tools-* -./configure --sysconf=/etc -sudo make install -#mkdir -p $HOME/.conpaas -cps-user get_certificate -cd .. -sudo rm -rf cps-tools* - -EOT -taballs+="$tools " -} - - -ls $frontend > /dev/null 2>&1 && -{ -cat <> $TMPFILE -tar -xaf cpsfrontend*.tar.gz -rm cpsfrontend*.tar.gz -sudo cp -r cpsfrontend-*/www/* /var/www/ -rm -rf cpsfrontend* -EOT -taballs+="$frontend " -} - - - -echo "" -echo "Uploading tarballs and execution script:" - -scp $TMPFILE $taballs conpaas: -ssh conpaas 'bash cpsinstall; rm cpsinstall' -# ssh conpaas 'cat cpsinstall; rm cpsinstall' - -rm -f ${TMPFILE}