#!/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-alpha.13} echo "$INFO Ozone version: $ozoneVersion" ozoneFolderName="ozone" ozoneInstallFolder="$PWD/$ozoneFolderName" # Check if ozone/ folder is already present if [ -d "${ozoneInstallFolder}" ]; then echo "$WARN Ozone installation directory (${ozoneInstallFolder}/) already exists." suffix=1 while [ -d "${ozoneInstallFolder}_${suffix}" ]; do suffix=$((suffix + 1)) done newOzoneInstallFolder="${ozoneInstallFolder}_${suffix}" echo "$INFO Creating new installation directory (${newOzoneInstallFolder}/)." ozoneInstallFolder="$newOzoneInstallFolder" mkdir -p "$ozoneInstallFolder" echo "$INFO If you want to overwrite the existing '${ozoneFolderName}/' folder, please delete it first." fi # Download Maven and install locally echo "$INFO Installing Maven $mavenVersion..." mavenVersion="3.9.11" 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 # Set up local Maven helper project to workaround issues when using the Maven dependency plugin from CLI. cat >_temp_install-latest-ozone-pom.xml < 4.0.0 install-latest-ozone-helper com.ozonehis Install Latest Ozone Helper Helper project to install the latest Ozone HIS 1.0.0-SNAPSHOT pom Ozone HIS https://www.ozone-his.com Mekom Solutions https://www.mekomsolutions.com UTF-8 com.ozonehis ozone zip ${ozoneVersion} org.apache.maven.plugins maven-dependency-plugin Fetch Ozone generate-resources unpack-dependencies true pom $ozoneInstallFolder ozone mks-nexus-public https://nexus.mekomsolutions.net/repository/maven-public/ EOF echo "$INFO Download and extract Ozone $ozoneVersion..." $mvn clean package -f _temp_install-latest-ozone-pom.xml rm _temp_install-latest-ozone-pom.xml # Move to the scripts/ folder 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-with-sso.sh"$RESET_FORMATTING echo "" echo "(💡 Refer to https://docs.ozone-his.com/ for more information)" echo ""