From b42559b1c90efe8260f78a41a89bc4b94410fa4e Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Mon, 11 Nov 2013 12:11:09 +0000
Subject: [PATCH] SP-1005, SWE-22: modified install-servers.sh to install from
 installation tar ball

SVN: 30125
---
 openbis_all/source/bash/install-servers.sh    | 52 +++++--------------
 .../bash/nightly-upgrade-generic-openbis.sh   | 10 ++--
 .../bash/nightly-upgrade-screening-openbis.sh | 14 +++--
 3 files changed, 25 insertions(+), 51 deletions(-)

diff --git a/openbis_all/source/bash/install-servers.sh b/openbis_all/source/bash/install-servers.sh
index 4714e83eeec..2a03ea27d59 100755
--- a/openbis_all/source/bash/install-servers.sh
+++ b/openbis_all/source/bash/install-servers.sh
@@ -2,21 +2,18 @@
 # 
 # Installs openBIS AS and DSS.
 # 
-# Usage: install-servers.sh <servers> <config snapshot repository> <builds fetching script> <config file list 1> ... <config file list n>
+# Usage: install-servers.sh <openBIS installation folder>
 # 
 # 
 # 
 # Dependencies: 
-# - servers-shutdown.sh
-# - create-config-snapshot.sh
-# - restore-config-snapshot.sh
-# - install.sh of the openBIS AS distribution
+# - fetch-ci-artifacts.sh
 # 
 set -o nounset
 set -o errexit
 
 if [ $# -lt 4 ]; then
-    echo "Usage: install-servers.sh <servers> <config snapshot repository> <builds fetching script> <config file list 1> ... <config file list n>"
+    echo "Usage: install-servers.sh <openBIS installation folder>
     exit 1
 fi
 
@@ -25,38 +22,17 @@ fi
 # Gathering parameters
 #
 BIN_DIR=`dirname "$0"`
-SERVERS="$1"
-REPOSITORY="$2"
-FETCHING_SCRIPT="$3"
-shift 3
+OPENBIS_ROOT_DIR="$1"
 
-OPENBIS_AS="$SERVERS/openBIS-server"
-OPENBIS_DSS="$SERVERS/datastore_server"
+echo "==== Fetsching openBIS installation tar ball"
+rm -rf "$OPENBIS_ROOT_DIR/"openBIS-installation*tar.gz
+"$BIN_DIR/fetch-ci-artifacts.sh" -d "$OPENBIS_ROOT_DIR" gradle-installation
 
-"$BIN_DIR/servers-shutdown.sh" "$SERVERS"
-"$BIN_DIR/create-config-snapshot.sh" "$SERVERS" "$REPOSITORY" "$@"
-rm -rf "$OPENBIS_AS"
-rm -rf "$OPENBIS_DSS"
-
-"$FETCHING_SCRIPT"
-echo "unzip openBIS-server*.zip"
-unzip -qu openBIS-server*.zip -d "$SERVERS"
-echo "unzip datastore_server-*.zip"
-unzip -quo datastore_server-*.zip -d "$SERVERS" 
-for file in datastore_server_plugin-*.zip; do 
-	if [ -f $file ]; then 
-    echo "unzip $file"
-		unzip -qun -d "$SERVERS" $file;
-	fi
-done
-rm -f openBIS-server*.zip
-rm -f datastore_server*.zip
-
-echo "==== Starting install script of the openBIS AS distribution"
-"$OPENBIS_AS/install.sh" "$OPENBIS_AS"
-echo "==== Finished install script of the openBIS AS distribution"
-
-YOUNGEST_REPOSITORY=`ls "$REPOSITORY"|sort -r|sed q`
-echo "==== Restore config snapshot $YOUNGEST_REPOSITORY"
-"$BIN_DIR/restore-config-snapshot.sh" "$SERVERS" "$REPOSITORY/$YOUNGEST_REPOSITORY/"
+echo "==== Unpack installation tar ball and replace console.properties"
+tar xzf "$OPENBIS_ROOT_DIR/"openBIS-installation*tar.gz -C "$OPENBIS_ROOT_DIR"
+rm -rf "$OPENBIS_ROOT_DIR/"openBIS-installation*tar.gz
+rm -f "$OPENBIS_ROOT_DIR/"openBis-installation*/console.properties
+cp "$OPENBIS_ROOT_DIR/console.properties" "$OPENBIS_ROOT_DIR/"openBis-installation*/
 
+echo "==== Upgrade installation"
+"$OPENBIS_ROOT_DIR/"openBis-installation*/run-console.sh
diff --git a/openbis_all/source/bash/nightly-upgrade-generic-openbis.sh b/openbis_all/source/bash/nightly-upgrade-generic-openbis.sh
index 4641de8811c..dc3d9d23e38 100644
--- a/openbis_all/source/bash/nightly-upgrade-generic-openbis.sh
+++ b/openbis_all/source/bash/nightly-upgrade-generic-openbis.sh
@@ -2,7 +2,7 @@
 # 
 # This script does the following:
 # - Creates a config snapshot of current installation.
-# - Install generic openBIS sprint servers based on latest builds on Hudson.
+# - Install generic openBIS sprint servers based on latest builds on Hudson/Jenkins.
 # - Using previous config files.
 # - Restore store and databases from latest snapshot.
 # - Restart AS and DSS.
@@ -13,7 +13,6 @@
 # Dependencies:
 # - check-and-exit-if-new-sprint-server.sh
 # - install-servers.sh
-# - fetch-generic-sprint-server-artifacts.sh
 # - servers-startup-from-latest-snapshot.sh
 # - config-files.txt
 #
@@ -21,7 +20,8 @@ set -o nounset
 set -o errexit
 
 BIN_DIR=`dirname "$0"`
-SERVERS=sprint
+BASE_DIR=openbis
+SERVERS=$BASE_DIR/servers
 VERSION_FILE=sprint-versions.txt
 
 echo ":::::::::::::::::::: Nightly Upgrade Generic openBIS Servers [`date`] :::::::::::::::::::::"
@@ -33,6 +33,6 @@ if ! "$BIN_DIR/check-and-exit-if-new-sprint-server.sh" "$SERVERS" "$VERSION_FILE
 # Upgrade servers and restart them
 #
 
-"$BIN_DIR/install-servers.sh" "$SERVERS"/ config-snapshots/ "$BIN_DIR/fetch-generic-sprint-server-artifacts.sh" "$BIN_DIR/config-files.txt" 
-"$BIN_DIR/servers-startup-from-latest-snapshot.sh" "$SERVERS" snapshots
+"$BIN_DIR/install-servers.sh" $BASE_DIR 
+"$BIN_DIR/servers-startup-from-latest-snapshot.sh" "$SERVERS" $BASE_DIR/snapshots
 
diff --git a/openbis_all/source/bash/nightly-upgrade-screening-openbis.sh b/openbis_all/source/bash/nightly-upgrade-screening-openbis.sh
index 4bb3bf4edd5..1a56d3b5623 100644
--- a/openbis_all/source/bash/nightly-upgrade-screening-openbis.sh
+++ b/openbis_all/source/bash/nightly-upgrade-screening-openbis.sh
@@ -2,7 +2,7 @@
 # 
 # This script does the following:
 # - Creates a config snapshot of current screening installation.
-# - Install screening openBIS sprint servers based on latest builds on Hudson.
+# - Install screening openBIS sprint servers based on latest builds on Hudson/Jenkins.
 # - Using previous config files.
 # - Restore store and databases from latest snapshot.
 # - Restart AS and DSS.
@@ -13,17 +13,15 @@
 # Dependencies:
 # - check-and-exit-if-new-sprint-server.sh
 # - install-servers.sh
-# - fetch-screening-sprint-server-artifacts.sh
 # - servers-startup-from-latest-snapshot.sh
-# - config-files.txt
-# - config-files-screening.txt
 #
 set -o nounset
 set -o errexit
 
 BIN_DIR=`dirname "$0"`
-SERVERS=screening/servers
-VERSION_FILE=screening/sprint-versions.txt
+BASE_DIR=screening
+SERVERS=$BASE_DIR/servers
+VERSION_FILE=$BASE_DIR/sprint-versions.txt
 
 echo ":::::::::::::::::::: Nightly Upgrade Screening openBIS Servers [`date`] :::::::::::::::::::::"
 
@@ -34,6 +32,6 @@ if ! "$BIN_DIR/check-and-exit-if-new-sprint-server.sh" "$SERVERS" "$VERSION_FILE
 # Upgrade servers and restart them
 #
 
-"$BIN_DIR/install-servers.sh" "$SERVERS"/ screening/config-snapshots/ "$BIN_DIR/fetch-screening-sprint-server-artifacts.sh" "$BIN_DIR/config-files.txt" "$BIN_DIR/config-files-screening.txt" 
-"$BIN_DIR/servers-startup-from-latest-snapshot.sh" "$SERVERS" screening/snapshots
+"$BIN_DIR/install-servers.sh" $BASE_DIR 
+"$BIN_DIR/servers-startup-from-latest-snapshot.sh" "$SERVERS" $BASE_DIR/snapshots
 
-- 
GitLab