From 4e1925ece644e08cb0a15413cbb082abb8f2a64e Mon Sep 17 00:00:00 2001 From: kaloyane <kaloyane> Date: Tue, 5 Jul 2011 15:31:21 +0000 Subject: [PATCH] use a temporary folder when installing/upgrading openBIS-server. This way the end-installation is not polluted with remnants from the archive. SVN: 22001 --- openbis/dist/admin/common-functions.sh | 41 +++++++++++++++++++++++- openbis/dist/admin/install.sh | 12 ++----- openbis/dist/admin/upgrade.sh | 9 ++---- screening/dist/admin/common-functions.sh | 41 +++++++++++++++++++++++- screening/dist/admin/install.sh | 13 ++------ screening/dist/admin/upgrade.sh | 9 ++---- 6 files changed, 92 insertions(+), 33 deletions(-) diff --git a/openbis/dist/admin/common-functions.sh b/openbis/dist/admin/common-functions.sh index 2a00c32541f..c300cecaed4 100644 --- a/openbis/dist/admin/common-functions.sh +++ b/openbis/dist/admin/common-functions.sh @@ -39,4 +39,43 @@ copyIfExists() if [ -f "$1" ]; then cp "$1" "$2" fi -} \ No newline at end of file +} + +# +# Installs openBIS server to a given destination +# The function assumes that the openBIS-server*.zip file is already present in the destination. +# +installOpenBisServer() +{ + if [ "$1" == "" ]; then + echo "ERROR: You must specify a folder to install openBIS-server" + exit 1 + fi + + INSTALL_DIR=$1 + TMP_EXTRACT=$INSTALL_DIR/tmp-extract + echo Installing openBIS Application Server to $INSTALL_DIR + + mkdir -p "$TMP_EXTRACT" + mkdir $INSTALL_DIR/openBIS-server + unzip $INSTALL_DIR/openBIS-*.zip -d "$TMP_EXTRACT" + $TMP_EXTRACT/openBIS-server/install.sh $INSTALL_DIR/openBIS-server + + rm -rf "$TMP_EXTRACT" +} + +# +# Installs Data Store Server to a given destination +# The function assumes that the datastore-server*.zip file is already present in the destination. +# +installDataStoreServer() +{ + if [ "$1" == "" ]; then + echo "ERROR: You must specify a folder to install Data Store Server" + exit 1 + fi + + INSTALL_DIR=$1 + echo Installing openBIS Datastore Server to $INSTALL_DIR + unzip $INSTALL_DIR/datastore*.zip -d $INSTALL_DIR +} diff --git a/openbis/dist/admin/install.sh b/openbis/dist/admin/install.sh index 9ba6a02932c..80a2ef1826f 100755 --- a/openbis/dist/admin/install.sh +++ b/openbis/dist/admin/install.sh @@ -8,6 +8,7 @@ if [ ${BASE#/} == ${BASE} ]; then fi source $BASE/env +source $BASE/common-functions.sh ROOT_DIR=$BASE/../servers BACKUP_DIR=$BASE/../backup @@ -15,15 +16,8 @@ BACKUP_DIR=$BASE/../backup mkdir -p $ROOT_DIR mkdir -p $BACKUP_DIR -echo Installing openBIS Datastore Server -unzip $ROOT_DIR/datastore*.zip -d $ROOT_DIR - -echo Installing openBIS Application Server -TMP_EXTRACT=$ROOT_DIR/tmp-extract -mkdir -p "$TMP_EXTRACT" -mkdir $ROOT_DIR/openBIS-server -unzip $ROOT_DIR/openBIS-*.zip -d "$TMP_EXTRACT" -$TMP_EXTRACT/openBIS-server/install.sh $ROOT_DIR/openBIS-server +installOpenBisServer $ROOT_DIR +installDataStoreServer $ROOT_DIR rm -rf "$TMP_EXTRACT" mv $ROOT_DIR/*.zip $BACKUP_DIR/ diff --git a/openbis/dist/admin/upgrade.sh b/openbis/dist/admin/upgrade.sh index 0d4bdfe0cdc..c876c12acb7 100755 --- a/openbis/dist/admin/upgrade.sh +++ b/openbis/dist/admin/upgrade.sh @@ -8,6 +8,7 @@ if [ ${BASE#/} == ${BASE} ]; then fi source $BASE/env +source $BASE/common-functions.sh ROOT_DIR=$BASE/../servers @@ -34,12 +35,8 @@ mv $ROOT_DIR/datastore_server $BACKUP_DIR/datastore_server # pg_restore -d db-name db-file.dmp pg_dump -U $DB_USER_NAME -Fc $OPENBIS_DB > $BACKUP_DIR/$OPENBIS_DB-${NOW}.dmp -echo Installing openBIS Datastore Server -unzip -qo $ROOT_DIR/datastore_server-screening*.zip -d $ROOT_DIR - -echo Installing openBIS Application Server -unzip -qo $ROOT_DIR/openBIS-*.zip -d $ROOT_DIR -$ROOT_DIR/openBIS-server/install.sh $ROOT_DIR/openBIS-server +installOpenBisServer $ROOT_DIR +installDataStoreServer $ROOT_DIR $BASE/restore-config-from-backup.sh $CONFIG cp -r $OLD_BIS/jetty/indices* $ROOT_DIR/openBIS-server/jetty/ diff --git a/screening/dist/admin/common-functions.sh b/screening/dist/admin/common-functions.sh index 63283870d5c..8b4e3cffb08 100644 --- a/screening/dist/admin/common-functions.sh +++ b/screening/dist/admin/common-functions.sh @@ -39,4 +39,43 @@ copyIfExists() if [ -f "$1" ]; then cp -R "$1" "$2" fi -} \ No newline at end of file +} + +# +# Installs openBIS server to a given destination +# The function assumes that the openBIS-server*.zip file is already present in the destination. +# +installOpenBisServer() +{ + if [ "$1" == "" ]; then + echo "ERROR: You must specify a folder to install openBIS-server" + exit 1 + fi + + INSTALL_DIR=$1 + TMP_EXTRACT=$INSTALL_DIR/tmp-extract + echo Installing openBIS Application Server to $INSTALL_DIR + + mkdir -p "$TMP_EXTRACT" + mkdir $INSTALL_DIR/openBIS-server + unzip $INSTALL_DIR/openBIS-*.zip -d "$TMP_EXTRACT" + $TMP_EXTRACT/openBIS-server/install.sh $INSTALL_DIR/openBIS-server + + rm -rf "$TMP_EXTRACT" +} + +# +# Installs Data Store Server to a given destination +# The function assumes that the datastore-server*.zip file is already present in the destination. +# +installDataStoreServer() +{ + if [ "$1" == "" ]; then + echo "ERROR: You must specify a folder to install Data Store Server" + exit 1 + fi + + INSTALL_DIR=$1 + echo Installing openBIS Datastore Server to $INSTALL_DIR + unzip $INSTALL_DIR/datastore*.zip -d $INSTALL_DIR +} diff --git a/screening/dist/admin/install.sh b/screening/dist/admin/install.sh index 8b2f6a231de..f133e2676f4 100755 --- a/screening/dist/admin/install.sh +++ b/screening/dist/admin/install.sh @@ -8,6 +8,7 @@ if [ ${BASE#/} == ${BASE} ]; then fi source $BASE/env +source $BASE/common-functions.sh ROOT_DIR=$BASE/../servers BACKUP_DIR=$BASE/../backup @@ -15,17 +16,9 @@ BACKUP_DIR=$BASE/../backup mkdir -p $ROOT_DIR mkdir -p $BACKUP_DIR -echo Installing openBIS Datastore Server -unzip $ROOT_DIR/datastore*.zip -d $ROOT_DIR +installOpenBisServer $ROOT_DIR +installDataStoreServer $ROOT_DIR -echo Installing openBIS Application Server -TMP_EXTRACT=$ROOT_DIR/tmp-extract -mkdir -p "$TMP_EXTRACT" -mkdir $ROOT_DIR/openBIS-server -unzip $ROOT_DIR/openBIS-*.zip -d "$TMP_EXTRACT" -$TMP_EXTRACT/openBIS-server/install.sh $ROOT_DIR/openBIS-server - -rm -rf "$TMP_EXTRACT" mv $ROOT_DIR/*.zip $BACKUP_DIR/ . $BASE/create-empty-screening-db.sh diff --git a/screening/dist/admin/upgrade.sh b/screening/dist/admin/upgrade.sh index e52a7c1eb49..68d3b9fdd9e 100755 --- a/screening/dist/admin/upgrade.sh +++ b/screening/dist/admin/upgrade.sh @@ -8,6 +8,7 @@ if [ ${BASE#/} == ${BASE} ]; then fi source $BASE/env +source $BASE/common-functions.sh ROOT_DIR=$BASE/../servers @@ -36,12 +37,8 @@ $PG_DUMP -U $DB_USER_NAME -Fc $OPENBIS_DB > $BACKUP_DIR/$OPENBIS_DB-${NOW}.dmp # screening-specific $PG_DUMP -U $DB_USER_NAME -Fc $IMAGING_DB > $BACKUP_DIR/$IMAGING_DB-${NOW}.dmp -echo Installing openBIS Datastore Server -unzip $ROOT_DIR/datastore_server-screening*.zip -d $ROOT_DIR - -echo Installing openBIS Application Server -unzip $ROOT_DIR/openBIS-server*.zip -d $ROOT_DIR -$ROOT_DIR/openBIS-server/install.sh $ROOT_DIR/openBIS-server +installOpenBisServer $ROOT_DIR +installDataStoreServer $ROOT_DIR $BASE/restore-config-from-backup.sh $CONFIG cp -r $OLD_BIS/jetty/indices* $ROOT_DIR/openBIS-server/jetty/ -- GitLab