Newer
Older
#!/bin/bash
# Performs the sprint components installation.
# This script assumes that you already are on the sprint server and must be run from that place
# in the home directory.
#
# If the file ~/.keystore exists it will replace openBIS.keystore of the distribution and
# the Java option -Djavax.net.ssl.trustStore=openBIS.keystore in the start up scripts will
# be removed assuming that ~/.keystore does not contains a self-signed certificate.
VER=SNAPSHOT
if [ $1 ]; then
VER=$1
fi
cd sprint-*
PREV_VER=${PWD#*-}
cd -
DB_SNAPSHOT=db_snapshots/sprint$PREV_VER-lims_productive.sql
KEYSTORE=~/.keystore
# Unalias rm and cp commands
unalias rm
echo Stopping the components...
./sprint/openBIS-server/apache-tomcat/bin/shutdown.sh
echo Making a database dump...
pg_dump -U postgres -O lims_productive > $DB_SNAPSHOT
tar -cf - $DB_SNAPSHOT | bzip2 >db_snapshots/sprint$PREV_VER-lims_productive.tar.bz2
rm -f $DB_SNAPSHOT
echo Installing openBIS server...
rm -rf old/sprint-$PREV_VER
rm -f sprint
mkdir sprint-$VER
ln -s sprint-$VER sprint
cd sprint
unzip ../openBIS-server*$VER*
./install.sh --nostartup $PWD ../../service.properties
if [ -f $KEYSTORE ]; then
cp -p $KEYSTORE apache-tomcat/openBIS.keystore
sed 's/-Djavax.net.ssl.trustStore=openBIS.keystore //g' apache-tomcat/bin/startup.sh > new-startup.sh
mv -f new-startup.sh apache-tomcat/bin/startup.sh
chmod 744 apache-tomcat/bin/startup.sh
fi
unzip ../datastore_server*$VER*
cp -p ~/datastore_server-service.properties etc/service.properties
if [ -f $KEYSTORE ]; then
cp -p $KEYSTORE etc/openBIS.keystore
cp -Rf ~/old/sprint-$PREV_VER/datastore_server/data/store/* data/store
sed 's/-Djavax.net.ssl.trustStore=etc\/openBIS.keystore //g' datastore_server.sh > xxx
mv -f xxx datastore_server.sh
fi
chmod 744 datastore_server.sh
mv -f *.zip tmp
rm -rf openbis
# Reset the rm command alias
alias 'rm=rm -i'