Skip to content

Commit

Permalink
OZ-522: Rename 'install-latest.sh' to 'install-stable.sh'
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuisson authored and corneliouzbett committed Apr 4, 2024
1 parent 44bfc3f commit 552f2aa
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 101 deletions.
101 changes: 0 additions & 101 deletions scripts/install-latest.sh

This file was deleted.

1 change: 1 addition & 0 deletions scripts/install-latest.sh
101 changes: 101 additions & 0 deletions scripts/install-stable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/usr/bin/env bash
set -e

#
# Helper script to download and install Ozone for trial purposes
#

# Set colors
export TEXT_BLUE=`tput setaf 4`
export TEXT_RED=`tput setaf 1`
export BOLD=`tput bold`
export RESET_FORMATTING=`tput sgr0`
INFO="$TEXT_BLUE$BOLD[INFO]$RESET_FORMATTING"
WARN="$TEXT_RED$BOLD[WARN]$RESET_FORMATTING"
ERROR="$TEXT_RED$BOLD[ERROR]$RESET_FORMATTING"

# Introduction message
echo " Installation script for ${BOLD}Ozone FOSS${RESET_FORMATTING} (for testing and demo purposes only)."
echo ""
echo " See https://docs.ozone-his.com/ for how to set it up for production."
echo ""


# TODO: Upon release, replace this with the latest stable version
ozoneVersion=${1:-1.0.0-SNAPSHOT}

echo "$INFO Ozone version: $ozoneVersion"

ozoneInstallFolder="$PWD/ozone"
# Check if ozone/ folder is already present
if [ -d "${ozoneInstallFolder}" ]
then
echo "$WARN Ozone installation directory (${ozoneInstallFolder}/) already exists."
while true; do
read -p "Do you want to overwrite? [y/n]" choice
case "$choice" in
y|Y ) rm -r ${ozoneInstallFolder}/;
break;;
n|N ) echo "$INFO Aborting.";
exit 0;;
* ) echo "Please enter y, Y, n or N.";;
esac
done
fi

# Download Maven and install locally
echo "$INFO Installing Maven $mavenVersion..."
mavenVersion="3.9.6"
mvn=apache-maven-${mavenVersion}/bin/mvn
if [ -f "$mvn" ]
then
echo "$INFO Maven $mavenVersion already present in the current folder."
echo "$INFO Skipping Maven installation..."
else
echo "$INFO Downloading Maven $mavenVersion..."
curl -O https://dlcdn.apache.org/maven/maven-3/${mavenVersion}/binaries/apache-maven-${mavenVersion}-bin.tar.gz
tar -xzvf apache-maven-${mavenVersion}-bin.tar.gz
fi

# Download Ozone
echo "$INFO Downloading Ozone $ozoneVersion..."
$mvn dependency:get \
-DgroupId=com.ozonehis \
-DartifactId=ozone \
-Dversion=${ozoneVersion} \
-Dpackaging=zip \
-DremoteRepositories=https://nexus.mekomsolutions.net/repository/maven-public \
-Dtransitive=false

# Copy and Unpack
echo "$INFO Extracting Ozone..."
$mvn dependency:copy \
-Dartifact=com.ozonehis:ozone:${ozoneVersion}:zip \
-DoutputDirectory=./ \
-DuseBaseVersion=true

# Account for some inconsistencies in some systems where Maven copies the files without a timestamp.
# Only rename the file if it is time-stamped.
if [ ! -f "ozone-${ozoneVersion}.zip" ]
then
echo "$INFO Rename to 'ozone-${ozoneVersion}.zip'..."
mv ozone-1.0.0-*.zip ozone-${ozoneVersion}.zip
fi

echo "$INFO Unzipping..."
unzip ozone-${ozoneVersion}.zip -d ${ozoneInstallFolder}
rm ozone-${ozoneVersion}.zip
pushd ozone/run/docker/scripts/

echo ""
echo "$INFO Ozone installed at $ozoneInstallFolder"
echo ""
echo "---"
echo ""
echo " Type in the following command to run Ozone:"
echo ""
echo " ${BOLD}cd ozone/run/docker/scripts/"
echo " ./start-demo.sh"$RESET_FORMATTING
echo ""
echo "(💡 Refer to https://docs.ozone-his.com/ for more information)"
echo ""

0 comments on commit 552f2aa

Please sign in to comment.