From 0bc2daf4ad0c70fe3f094a7c91e0ab11ef8f3b39 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 3 Oct 2019 20:19:13 +0200 Subject: [PATCH] Rework FrontlineSMS --- lxc-apps/frontlinesms/install.sh | 10 +++------- .../install/etc/init.d/frontlinesms | 19 ------------------- .../app-settings.properties | 0 lxc-apps/frontlinesms/lxcfile | 2 -- lxc-apps/frontlinesms/meta | 18 ++++++++++++++++++ lxc-apps/frontlinesms/uninstall.sh | 5 ++--- 6 files changed, 23 insertions(+), 31 deletions(-) delete mode 100755 lxc-apps/frontlinesms/install/etc/init.d/frontlinesms rename lxc-apps/frontlinesms/install/{srv/frontlinesms/data => flsms_data}/app-settings.properties (100%) create mode 100644 lxc-apps/frontlinesms/meta diff --git a/lxc-apps/frontlinesms/install.sh b/lxc-apps/frontlinesms/install.sh index a588c2e..94b2086 100755 --- a/lxc-apps/frontlinesms/install.sh +++ b/lxc-apps/frontlinesms/install.sh @@ -4,17 +4,13 @@ set -ev cd $(realpath $(dirname "${0}"))/install # Configure FrontlineSMS -mkdir -p /srv/frontlinesms/data +mkdir -p /srv/frontlinesms/flsms_data export FRONTLINESMS_ADMIN_USER="admin" export FRONTLINESMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') export FRONTLINESMS_ADMIN_USER_HASH=$(echo -n "${FRONTLINESMS_ADMIN_USER}" | base64) export FRONTLINESMS_ADMIN_PWD_HASH=$(echo -n "${FRONTLINESMS_ADMIN_PWD}" | base64) -envsubst /srv/frontlinesms/data/app-settings.properties -chown -R 8018:8018 /srv/frontlinesms/data - -# Install service -cp etc/init.d/frontlinesms /etc/init.d/frontlinesms -rc-update -u +envsubst /srv/frontlinesms/flsms_data/app-settings.properties +chown -R 8018:8018 /srv/frontlinesms/flsms_data # Register application vmmgr register-app frontlinesms sms "${FRONTLINESMS_ADMIN_USER}" "${FRONTLINESMS_ADMIN_PWD}" diff --git a/lxc-apps/frontlinesms/install/etc/init.d/frontlinesms b/lxc-apps/frontlinesms/install/etc/init.d/frontlinesms deleted file mode 100755 index ff41d5f..0000000 --- a/lxc-apps/frontlinesms/install/etc/init.d/frontlinesms +++ /dev/null @@ -1,19 +0,0 @@ -#!/sbin/openrc-run - -description="FrontlineSMS container" - -start() { - lxc-start frontlinesms -} - -start_post() { - vmmgr register-proxy frontlinesms -} - -stop_pre() { - vmmgr unregister-proxy frontlinesms -} - -stop() { - lxc-stop frontlinesms -} diff --git a/lxc-apps/frontlinesms/install/srv/frontlinesms/data/app-settings.properties b/lxc-apps/frontlinesms/install/flsms_data/app-settings.properties similarity index 100% rename from lxc-apps/frontlinesms/install/srv/frontlinesms/data/app-settings.properties rename to lxc-apps/frontlinesms/install/flsms_data/app-settings.properties diff --git a/lxc-apps/frontlinesms/lxcfile b/lxc-apps/frontlinesms/lxcfile index ecc12cf..ab5aa65 100644 --- a/lxc-apps/frontlinesms/lxcfile +++ b/lxc-apps/frontlinesms/lxcfile @@ -38,6 +38,4 @@ RUN EOF chown 8018:8018 frontlinesms-core_messages_cs* EOF -MOUNT DIR /srv/frontlinesms/data srv/frontlinesms/.frontlinesms2 - CMD s6-svscan /etc/services.d diff --git a/lxc-apps/frontlinesms/meta b/lxc-apps/frontlinesms/meta new file mode 100644 index 0000000..3413c92 --- /dev/null +++ b/lxc-apps/frontlinesms/meta @@ -0,0 +1,18 @@ +{ + "version": "0.0.1-190620", + "meta": { + "title": "FrontlineSMS", + "desc-cs": "Hromadné odesílání zpráv", + "desc-en": "Bulk SMS messaging", + "license": "GPL", + "proxy": "frontlinesms" + }, + "containers": { + "frontlinesms": { + "image": "frontlinesms_0.0.1-190620", + "mounts": [ + ["DIR", "/srv/frontlinesms/flsms_data", "/srv/frontlinesms/.frontlinesms2"] + ] + } + } +} diff --git a/lxc-apps/frontlinesms/uninstall.sh b/lxc-apps/frontlinesms/uninstall.sh index e22e404..31932e4 100755 --- a/lxc-apps/frontlinesms/uninstall.sh +++ b/lxc-apps/frontlinesms/uninstall.sh @@ -1,9 +1,8 @@ #!/bin/sh set -ev -# Remove service -rm -f /etc/init.d/frontlinesms -rc-update -u +# Remove persistent data +rm -rf /srv/frontlinesms # Unregister application vmmgr unregister-app frontlinesms