#!/bin/bash # # Copyright (C) Wendepunkt Medical Innovations, Inc - All Rights Reserved. # Unauthorized copying of this file, via any medium is strictly prohibited. # Proprietary and confidential # # For information: dev@signalytic.ca # # # Install the streamline-emr application # # The caller of this script must check the exit value and possibly do a # roll-back if it is non-zero. If the exit value is non-zero services have not # been restarted. # # Note: This version resets data from v1 installations LOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" if [ "$EUID" -ne 0 ] then echo "Please run as root" exit 1 fi set -e APP_SLUG="streamline_emr" ORG_SLUG="streamline" INSTALL_ROOT="/var/signalytic/clientapps/${ORG_SLUG}/${APP_SLUG}" VERSION_FILE="${INSTALL_ROOT}/version" DATA_ROOT="${INSTALL_ROOT}/data" # stop the application (if installed) if [ -f ${INSTALL_ROOT}/stop ]; then ${INSTALL_ROOT}/stop fi # reset data for any v1 or v2.0 installations if grep -q "^1." ${VERSION_FILE} || grep -q "^2.0" ${VERSION_FILE}; then echo "demo installation detected (v$(cat ${VERSION_FILE})) - resetting data" rm -rf ${DATA_ROOT} fi # copy root files (if present) if [ -d "${LOCATION}/root" ] && [ -n "$(ls -A ${LOCATION}/root)" ]; then echo "importing root files" cp -rfv $LOCATION/root/* / fi # import docker images (if present) for f in $(find $LOCATION/images -name "*.img" 2>/dev/null);do echo "importing docker image: $f" docker load -i $f done for f in $(find $LOCATION/images -name "*.img.xz" 2>/dev/null);do echo "importing docker image: $f" xz -d -c $f | docker load done # start the application ${INSTALL_ROOT}/start