From a1af588246affad2f98eccd3d41aa4d40c1c7376 Mon Sep 17 00:00:00 2001 From: Christopher James Halse Rogers Date: Thu, 5 Nov 2020 16:53:18 +1100 Subject: [PATCH] Initial snapcraft metadata --- snap/hooks/configure | 19 ++++++++++++++++++ snap/local/set-environment | 23 ++++++++++++++++++++++ snap/snapcraft.yaml | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 snap/hooks/configure create mode 100755 snap/local/set-environment create mode 100644 snap/snapcraft.yaml diff --git a/snap/hooks/configure b/snap/hooks/configure new file mode 100644 index 00000000..ccbb2a58 --- /dev/null +++ b/snap/hooks/configure @@ -0,0 +1,19 @@ +#!/bin/sh + +base_url="$(snapctl get base-url)" +enabled="$(snapctl get enabled)" + +if [ -n ${enabled} -a \( "${enabled}" != "true" -a "${enabled}" != "false" \) ] +then + echo "Invalid 'enabled' setting: ${enabled}. Valid values are 'true' or 'false'" + exit 1 +fi + +if [ -n ${base_url} -a \( -z "${enabled}" -o "${enabled}" = "false" \) ] +then + echo "All required configuration available." + echo "Conduit can now be enabled by setting 'snap set conduit enabled=true' and restarting the service \ +with 'snap restart conduit'" +fi + +exit 0 diff --git a/snap/local/set-environment b/snap/local/set-environment new file mode 100755 index 00000000..79a8f95b --- /dev/null +++ b/snap/local/set-environment @@ -0,0 +1,23 @@ +#!/bin/sh + +enabled="$(snapctl get enabled)" +if [ -z "${enabled}" -o "${enabled}" != "true" ] +then + echo "Conduit not yet enabled" + exit 0 +fi + +export ROCKET_SERVER_NAME="$(snapctl get base-url)" + +listen_address="$(snapctl get listen.address)" +if [ -n "${listen_address}" ] +then + export ROCKET_ADDRESS="$(snapctl get listen.address)" + export ROCKET_PORT="$(snapctl get listen.port)" +fi + +export ROCKET_ENV="production" +export ROCKET_DATABASE_PATH=${SNAP_DATA} + +cd ${SNAP} +exec $@ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 00000000..4eae1028 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,40 @@ +name: conduit +base: core20 +version: git +summary: A Matrix homeserver written in Rust +description: | + A fast Matrix homeserver that's easy to set up and just works. You can + install it on a mini-computer like the Raspberry Pi to host Matrix for + your family, friends or company. + + Conduit is under heavy development, and many features of a fully-functional + Matrix server are incomplete or missing, but + + What are the biggest things still missing? + * Appservices (Bridges and Bots) + * Most federation features (invites, e2ee) + * Push notifications on mobile + * Notification settings + * Lots of testing + +grade: devel # must be 'stable' to release into candidate/stable channels +confinement: strict # use 'strict' once you have the right plugs and slots + +apps: + conduit: + daemon: simple + command: set-environment bin/conduit + plugs: + - network + - network-bind + +parts: + conduit: + plugin: rust + source: . + build-packages: + - libssl-dev + - pkg-config + snap-helper: + plugin: dump + source: snap/local/