Files
streamline-emr/install.sh
T
alec.turner 50cb23a4c7 Packaging improvements
- compress images with xz by default (and decompress on install)
- add help menu and command line argument parsing to package.sh
- display packaging status if `pv` command available
2024-03-11 16:29:59 -07:00

56 lines
1.4 KiB
Bash
Executable File

#!/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 "Streamline EMR" application and services
#
# 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.
LOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit 1
fi
# stop any running systemd service if not running in a docker environment
if [ -f /.dockerenv ]; then
echo "Docker environment detected - skipping systemd installation"
else
echo "stopping system service"
systemctl stop streamline-emr
fi
set -e
# copy root files
echo "importing root files"
cp -rfv $LOCATION/root/* /
# import docker images
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
# install systemd service unless running in a docker environment
if [ ! -f /.dockerenv ]; then
echo "installing system service"
systemctl daemon-reload
systemctl enable streamline-emr
systemctl start streamline-emr
fi