#!/bin/sh SOURCE_DIR=$(realpath $(dirname "${0}"))/flsms # Check prerequisites docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh # Build Docker container docker build -t flsms ${SOURCE_DIR} cp ${SOURCE_DIR}/etc/init.d/flsms /etc/init.d/flsms rc-update -u # Configure FrontlineSMS mkdir -p /srv/flsms/data export FLSMS_ADMIN_USER="admin" export FLSMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export FLSMS_ADMIN_USER_HASH=$(echo -n "${FLSMS_ADMIN_USER}" | base64) export FLSMS_ADMIN_PWD_HASH=$(echo -n "${FLSMS_ADMIN_PWD}" | base64) envsubst <${SOURCE_DIR}/srv/flsms/data/app-settings.properties >/srv/flsms/data/app-settings.properties chown -R 8018:8018 /srv/flsms/data spotter-appmgr update-login flsms "${FLSMS_ADMIN_USER}" "${FLSMS_ADMIN_PWD}"