Spotter-VM/frontlinesms.sh

19 lines
802 B
Bash
Raw Normal View History

2018-04-21 22:43:57 +02:00
#!/bin/sh
SOURCE_DIR=$(realpath $(dirname "${0}"))/frontlinesms
# Build Docker container
docker build -t frontlinesms ${SOURCE_DIR}
cp ${SOURCE_DIR}/etc/init.d/frontlinesms /etc/init.d/frontlinesms
rc-update -u
# Configure FrontlineSMS
mkdir -p /srv/frontlinesms/data
export FRONTLINESMS_ADMIN_USER="admin"
export FRONTLINESMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export FRONTLINESMS_ADMIN_USER_HASH=$(echo -n "${FRONTLINESMS_ADMIN_USER}" | base64)
export FRONTLINESMS_ADMIN_PWD_HASH=$(echo -n "${FRONTLINESMS_ADMIN_PWD}" | base64)
envsubst <${SOURCE_DIR}/srv/frontlinesms/data/app-settings.properties >/srv/frontlinesms/data/app-settings.properties
chown -R 8018:8018 /srv/frontlinesms/data
spotter-appmgr update-login frontlinesms "${FRONTLINESMS_ADMIN_USER}" "${FRONTLINESMS_ADMIN_PWD}"