mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
add custom install script to clear v1 data
The script `install.sh` largely copies the template from the hosted-app-utils
project, with some key changes:
1. replace template parameters (`{{VAR}}`) with hard-coded values
2. define variables for org, app, install root, etc
3. if old version detected, remove data folder before installing update
The modified script will:
1. delete v1 data
2. update normally when v2 or newer installations are present
This commit is contained in:
Executable
+62
@@ -0,0 +1,62 @@
|
|||||||
|
#!/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 installations
|
||||||
|
if grep -q "^1." ${VERSION_FILE}; then
|
||||||
|
echo "v1 installation detected - 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
|
||||||
@@ -5,5 +5,6 @@ LOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|||||||
CONFIG=${CONFIG:-${LOCATION}/config.json}
|
CONFIG=${CONFIG:-${LOCATION}/config.json}
|
||||||
SRC=${SRC:-${LOCATION}/src}
|
SRC=${SRC:-${LOCATION}/src}
|
||||||
BUILD_DIR=${BUILD_DIR:-${LOCATION}/build-packages}
|
BUILD_DIR=${BUILD_DIR:-${LOCATION}/build-packages}
|
||||||
|
INSTALL_SCRIPT=${LOCATION}/install.sh
|
||||||
|
|
||||||
${LOCATION}/hosted-app-utils/package ${CONFIG} ${SRC} output=${BUILD_DIR} $@
|
${LOCATION}/hosted-app-utils/package ${CONFIG} ${SRC} ${INSTALL_SCRIPT} output=${BUILD_DIR} $@
|
||||||
|
|||||||
Reference in New Issue
Block a user