From 7e00caa84dbd41fe122ba61c954a9d8efd564e76 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Mon, 23 Mar 2009 10:16:42 +0000
Subject: [PATCH] LMS-803 script for snapshot build added, sprint installation
 script adapted according to the requirements.

SVN: 10322
---
 openbis_all/source/bash/build_snapshot.sh | 24 +++++++++++++++++++
 openbis_all/source/bash/sprint_install.sh | 29 ++++++++++++++++-------
 2 files changed, 45 insertions(+), 8 deletions(-)
 create mode 100755 openbis_all/source/bash/build_snapshot.sh

diff --git a/openbis_all/source/bash/build_snapshot.sh b/openbis_all/source/bash/build_snapshot.sh
new file mode 100755
index 00000000000..83dd9114a07
--- /dev/null
+++ b/openbis_all/source/bash/build_snapshot.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Builds snapshot distributions of the software components, uploads them to sprint server.
+#
+# This script assumes that you have a SSH access on 'sprint-openbis.ethz.ch'. 
+# This is typically configured in the SSH config file.
+
+SPRINT_SERVER=sprint-openbis.ethz.ch
+SPRINT_INSTALL_SCRIPT=sprint_install.sh
+
+svn checkout http://source.systemsx.ch/repos/cisd/build_resources/trunk build_resources
+cd build_resources
+echo Building openBIS...
+./build.sh openbis_all
+
+echo Copying new openBIS components to \'$SPRINT_SERVER\'...
+scp openBIS-server-*.zip $SPRINT_SERVER:.
+scp datastore_server-*.zip $SPRINT_SERVER:.
+
+# If sprint install script is present and executable, run it!
+if [ -x $SPRINT_INSTALL_SCRIPT ]; then
+    echo Installing server remotely...
+    cat $SPRINT_INSTALL_SCRIPT | ssh -T $SPRINT_SERVER "cat > ~/$SPRINT_INSTALL_SCRIPT ; chmod 755 ~/$SPRINT_INSTALL_SCRIPT ; ~/$SPRINT_INSTALL_SCRIPT ; rm -f ~/$SPRINT_INSTALL_SCRIPT"
+fi
+echo Done!
\ No newline at end of file
diff --git a/openbis_all/source/bash/sprint_install.sh b/openbis_all/source/bash/sprint_install.sh
index 34fcbbfb3c6..d7ebc48a985 100755
--- a/openbis_all/source/bash/sprint_install.sh
+++ b/openbis_all/source/bash/sprint_install.sh
@@ -4,13 +4,20 @@
 # in the home directory.
 
 if [ $# -lt 1 ]; then
-    echo "Usage: $0 <sprint number>"
+    echo "Usage: $0 [<sprint number>]"
     exit 1
 fi
 
-VER=$1
-PREV_VER=$(( $VER - 1 ))
+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 command
 unalias rm
@@ -25,27 +32,33 @@ tar -cf - $DB_SNAPSHOT | bzip2 >db_snapshots/sprint$PREV_VER-lims_productive.tar
 rm -f $DB_SNAPSHOT
 
 echo Installing openBIS server...
+rm -rf old/sprint-$PREV_VER
 mv sprint-$PREV_VER old
 rm -f sprint
 mkdir sprint-$VER
 ln -s sprint-$VER sprint
 cd sprint
-unzip ../openBIS-server-S$VER*
+unzip ../openBIS-server*$VER*
 cd openBIS-server
-./install.sh $PWD ../../service.properties
+./install.sh --nostartup $PWD ../../service.properties
+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
+bin/startup.sh
 
 echo Installing datastore server...
 cd ..
-unzip ../datastore_server-S$VER*
+unzip ../datastore_server*$VER*
 cd datastore_server
-cp ~/datastore_server-service.properties etc/service.properties
+cp -p ~/datastore_server-service.properties etc/service.properties
+cp -p $KEYSTORE etc/openBIS.keystore
 chmod 700 datastore_server.sh
 export JAVA_HOME=/usr
 ./datastore_server.sh start
 
 echo Doing some cleaning...
 cd
-mv *.zip tmp
+mv -f *.zip tmp
 rm -rf openbis
 
 # Reset the rm command alias
-- 
GitLab