27 lines
883 B
Bash
Executable File
27 lines
883 B
Bash
Executable File
#!/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}
|
|
|
|
# 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
|
|
|
|
# Create FrontlineSMS service
|
|
cp ${SOURCE_DIR}/etc/init.d/flsms /etc/init.d/flsms
|
|
rc-update add flsms
|
|
service flsms start
|
|
|
|
# Add application definition
|
|
spotter-appmgr add-app flsms "https://flsms.{host}/" "${FLSMS_ADMIN_USER}" "${FLSMS_ADMIN_PWD}"
|