mirror of
https://github.com/YunoHost-Apps/mautrix_signal_ynh.git
synced 2024-09-03 19:46:07 +02:00
Merge pull request #56 from YunoHost-Apps/fix-package_check
Fix package check
This commit is contained in:
commit
883c3d7708
23 changed files with 487 additions and 395 deletions
|
@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide
|
||||||
1. *Read this whole template first.*
|
1. *Read this whole template first.*
|
||||||
2. *Determine if you are on the right place:*
|
2. *Determine if you are on the right place:*
|
||||||
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||||
- *Otherwise, the issue may be due to mautrix_signal itself. Refer to its documentation or repository for help.*
|
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
|
||||||
- *When in doubt, post here and we will figure it out together.*
|
- *When in doubt, post here and we will figure it out together.*
|
||||||
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||||
---
|
---
|
||||||
|
@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide
|
||||||
|
|
||||||
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
||||||
```sh
|
```sh
|
||||||
sudo yunohost app install mautrix_signal
|
sudo yunohost app install the_app
|
||||||
```
|
```
|
||||||
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
||||||
- *If the error occurs in your browser, explain what you did:*
|
- *If the error occurs in your browser, explain what you did:*
|
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
- *Description of why you made this PR*
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
- *And how do you fix that problem*
|
||||||
|
|
||||||
|
## PR Status
|
||||||
|
|
||||||
|
- [ ] Code finished and ready to be reviewed/tested
|
||||||
|
- [ ] The fix/enhancement were manually tested (if applicable)
|
||||||
|
|
||||||
|
## Automatic tests
|
||||||
|
|
||||||
|
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
|
107
.github/workflows/updater.sh
vendored
Normal file
107
.github/workflows/updater.sh
vendored
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PACKAGE UPDATING HELPER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# This script is meant to be run by GitHub Actions
|
||||||
|
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
||||||
|
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||||
|
# automatic actions when a new upstream release is detected.
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Fetching information
|
||||||
|
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||||
|
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||||
|
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||||
|
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||||
|
assets="https://github.com/$repo/archive/refs/tags/$version.tar.gz"
|
||||||
|
|
||||||
|
# Later down the script, we assume the version has only digits and dots
|
||||||
|
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||||
|
# You may need more tweaks here if the upstream repository has different naming conventions.
|
||||||
|
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
||||||
|
version=${version:1}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Setting up the environment variables
|
||||||
|
echo "Current version: $current_version"
|
||||||
|
echo "Latest release from upstream: $version"
|
||||||
|
echo "VERSION=$version" >> $GITHUB_ENV
|
||||||
|
echo "REPO=$repo" >> $GITHUB_ENV
|
||||||
|
# For the time being, let's assume the script will fail
|
||||||
|
echo "PROCEED=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Proceed only if the retrieved version is greater than the current one
|
||||||
|
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||||
|
echo "::warning ::No new version available"
|
||||||
|
exit 0
|
||||||
|
# Proceed only if a PR for this new version does not already exist
|
||||||
|
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||||
|
echo "::warning ::A branch already exists for this update"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPDATE SOURCE FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Let's download source tarball
|
||||||
|
asset_url=$assets
|
||||||
|
|
||||||
|
echo "Handling asset at $asset_url"
|
||||||
|
|
||||||
|
src="app"
|
||||||
|
|
||||||
|
# Create the temporary directory
|
||||||
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
|
# Download sources and calculate checksum
|
||||||
|
filename=${asset_url##*/}
|
||||||
|
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
||||||
|
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||||
|
|
||||||
|
# Delete temporary directory
|
||||||
|
rm -rf $tempdir
|
||||||
|
|
||||||
|
# Get extension
|
||||||
|
if [[ $filename == *.tar.gz ]]; then
|
||||||
|
extension=tar.gz
|
||||||
|
else
|
||||||
|
extension=${filename##*.}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rewrite source file
|
||||||
|
cat <<EOT > conf/$src.src
|
||||||
|
SOURCE_URL=$asset_url
|
||||||
|
SOURCE_SUM=$checksum
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=$extension
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=mautrix-facebook.tar.gz
|
||||||
|
SOURCE_EXTRACT=false
|
||||||
|
EOT
|
||||||
|
echo "... conf/$src.src updated"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPDATE STEPS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Any action on the app's source code can be done.
|
||||||
|
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Replace new version in manifest
|
||||||
|
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
||||||
|
|
||||||
|
# No need to update the README, yunohost-bot takes care of it
|
||||||
|
|
||||||
|
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||||
|
echo "PROCEED=true" >> $GITHUB_ENV
|
||||||
|
exit 0
|
49
.github/workflows/updater.yml
vendored
Normal file
49
.github/workflows/updater.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
||||||
|
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
||||||
|
# This file should be enough by itself, but feel free to tune it to your needs.
|
||||||
|
# It calls updater.sh, which is where you should put the app-specific update steps.
|
||||||
|
name: Check for new upstream releases
|
||||||
|
on:
|
||||||
|
# Allow to manually trigger the workflow
|
||||||
|
workflow_dispatch:
|
||||||
|
# Run it every day at 6:00 UTC
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 * * *'
|
||||||
|
jobs:
|
||||||
|
updater:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Fetch the source code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Run the updater script
|
||||||
|
id: run_updater
|
||||||
|
run: |
|
||||||
|
# Setting up Git user
|
||||||
|
git config --global user.name 'yunohost-bot'
|
||||||
|
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||||
|
# Run the updater script
|
||||||
|
/bin/bash .github/workflows/updater.sh
|
||||||
|
- name: Commit changes
|
||||||
|
id: commit
|
||||||
|
if: ${{ env.PROCEED == 'true' }}
|
||||||
|
run: |
|
||||||
|
git commit -am "Upgrade to v$VERSION"
|
||||||
|
- name: Create Pull Request
|
||||||
|
id: cpr
|
||||||
|
if: ${{ env.PROCEED == 'true' }}
|
||||||
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
commit-message: Update to version ${{ env.VERSION }}
|
||||||
|
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||||
|
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||||
|
signoff: false
|
||||||
|
base: testing
|
||||||
|
branch: ci-auto-update-v${{ env.VERSION }}
|
||||||
|
delete-branch: true
|
||||||
|
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||||
|
body: |
|
||||||
|
Upgrade to v${{ env.VERSION }}
|
||||||
|
draft: false
|
|
@ -15,7 +15,8 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Matrix / Synapse puppeting bridge for Signal
|
A puppeting bridge between Matrix and Signal packaged as a YunoHost service. Messages, notifications (and sometimes media) are bridged between a Signal user and a Matrix user. Currently the Matrix user can NOT invite other Matrix user in a bridged Signal room, so only someone with a Signal account can participate to Signal group conversations. The ["Mautrix-Signal"](https://docs.mau.fi/bridges/python/signal/index.html) bridge consists in a Synapse App Service and relies on postgresql (mysql also possible). Therefore, [Synapse for YunoHost](https://github.com/YunoHost-Apps/synapse_ynh) should be installed beforehand.
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 0.3.0~ynh1
|
**Shipped version:** 0.3.0~ynh1
|
||||||
|
|
||||||
|
@ -95,8 +96,11 @@ In case you need to upload your logs somewhere, be aware that they contain your
|
||||||
|
|
||||||
* It looks like media are not bridged.
|
* It looks like media are not bridged.
|
||||||
* Signal chats are not grouped in a Matrix community (as opposed to the Mautrix-WhatsApp or Mautrix-Facebook bridges)
|
* Signal chats are not grouped in a Matrix community (as opposed to the Mautrix-WhatsApp or Mautrix-Facebook bridges)
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
|
* Official user documentation: <https://docs.mau.fi/bridges/python/signal/index.html>
|
||||||
|
* Upstream app code repository: <https://github.com/mautrix/signal>
|
||||||
* YunoHost documentation for this app: <https://yunohost.org/app_mautrix_signal>
|
* YunoHost documentation for this app: <https://yunohost.org/app_mautrix_signal>
|
||||||
* Report a bug: <https://github.com/YunoHost-Apps/mautrix_signal_ynh/issues>
|
* Report a bug: <https://github.com/YunoHost-Apps/mautrix_signal_ynh/issues>
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,16 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
||||||
|
|
||||||
## Vue d'ensemble
|
## Vue d'ensemble
|
||||||
|
|
||||||
Passerelle Matrix / Synapse pour Signal
|
Une passerelle entre Matrix et Signal empaquetée comme un service YunoHost. Les messages, médias et notifications sont relayées entre un compte Signal et un compte Matrix.
|
||||||
|
La passerelle ["Mautrix-Signal"](https://docs.mau.fi/bridges/python/signal/index.html) consiste en un Service d'Application Matrix-Synapse et repose sur une base-de-données postgresql. C'est pourquoi [Synapse for YunoHost](https://github.com/YunoHost-Apps/synapse_ynh) doit être préalablemnet installé.
|
||||||
|
|
||||||
|
** Attention : sauvegardez et restaurez toujours les deux applications Yunohost matrix-synapse et mautrix_signal en même temps!**
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 0.3.0~ynh1
|
**Version incluse :** 0.3.0~ynh1
|
||||||
|
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
|
|
||||||
## Liste de passerelles publiques
|
## Liste de passerelles publiques
|
||||||
|
|
||||||
* Demandez sur un des salons suivants: #mautrix_yunohost:matrix.fdn.fr or #signal:maunium.net
|
* Demandez sur un des salons suivants: #mautrix_yunohost:matrix.fdn.fr or #signal:maunium.net
|
||||||
|
@ -88,6 +91,8 @@ Si vous devez téléverser vos fichiers log quelque-part, soyez avertis qu'ils c
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
|
* Documentation officielle utilisateur : <https://docs.mau.fi/bridges/python/signal/index.html>
|
||||||
|
* Dépôt de code officiel de l'app : <https://github.com/mautrix/signal>
|
||||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_mautrix_signal>
|
* Documentation YunoHost pour cette app : <https://yunohost.org/app_mautrix_signal>
|
||||||
* Signaler un bug : <https://github.com/YunoHost-Apps/mautrix_signal_ynh/issues>
|
* Signaler un bug : <https://github.com/YunoHost-Apps/mautrix_signal_ynh/issues>
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
# See here for more information
|
|
||||||
# https://github.com/YunoHost/package_check#syntax-of-check_process
|
|
||||||
|
|
||||||
;; Test complet
|
;; Test complet
|
||||||
# auto_remove=1
|
# auto_remove=1
|
||||||
; pre-install
|
; pre-install
|
||||||
sudo yunohost tools update apps
|
sudo yunohost tools update apps
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/ -a "domain=$domain&server_name=$server_name&is_public=$is_public&jitsi_server=$jitsi_server" --force
|
sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/ -a "domain=$domain&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force
|
||||||
; Manifest
|
; Manifest
|
||||||
# mautrix_signal manifest parameters
|
|
||||||
port="8449" (PORT)
|
port="8449" (PORT)
|
||||||
synapsenumber="1"
|
synapsenumber="1"
|
||||||
botname="signalbot"
|
botname="signalbot"
|
||||||
|
@ -23,15 +19,12 @@
|
||||||
setup_public=0
|
setup_public=0
|
||||||
upgrade=1
|
upgrade=1
|
||||||
# upgrade=1 from_commit=fc1ba62e6529bb529a413d5895398baa5f2029d7
|
# upgrade=1 from_commit=fc1ba62e6529bb529a413d5895398baa5f2029d7
|
||||||
|
# 0.2.3~ynh1
|
||||||
|
upgrade=1 from_commit=40c16d3c8898196c6e1a43e8f0af70c052dd41f6
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=1
|
port_already_use=1
|
||||||
change_url=0
|
change_url=0
|
||||||
actions=0
|
actions=0
|
||||||
config_panel=0
|
config_panel=0
|
||||||
#;;; Levels
|
|
||||||
# # If the level 5 (Package linter) is forced to 1. Please add justifications here.
|
|
||||||
# Level 5=auto
|
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
# ; commit=fc1ba62e6529bb529a413d5895398baa5f2029d7
|
|
||||||
# name=0.2.0
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
SOURCE_URL=https://mau.dev/mautrix/signal/-/archive/v0.3.0/signal-v0.3.0.tar.gz
|
SOURCE_URL=https://github.com/mautrix/signal/archive/refs/tags/v0.3.0.tar.gz
|
||||||
SOURCE_SUM=3d66cd1c27a82f964a1523acfd1a4f1ef1793815ec7730a89b26afd7e450dfd6
|
SOURCE_SUM=ea1ed7848dbb8cbb947d441a01f6f0c8fad0791601d6e36d90c3e50cbade30d3
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=mautrix-signal.tar.gz
|
||||||
SOURCE_EXTRACT=false
|
SOURCE_EXTRACT=false
|
||||||
#SOURCE_FILENAME=mautrix-signal.tar.gz
|
|
||||||
|
|
|
@ -7,6 +7,9 @@ homeserver:
|
||||||
# Whether or not to verify the SSL certificate of the homeserver.
|
# Whether or not to verify the SSL certificate of the homeserver.
|
||||||
# Only applies if address starts with https://
|
# Only applies if address starts with https://
|
||||||
verify_ssl: true
|
verify_ssl: true
|
||||||
|
# Whether or not the homeserver supports asmux-specific endpoints,
|
||||||
|
# such as /_matrix/client/unstable/net.maunium.asmux/dms for atomically
|
||||||
|
# updating m.direct.
|
||||||
asmux: false
|
asmux: false
|
||||||
# Number of retries for all HTTP requests if the homeserver isn't reachable.
|
# Number of retries for all HTTP requests if the homeserver isn't reachable.
|
||||||
http_retry_count: 4
|
http_retry_count: 4
|
||||||
|
@ -138,12 +141,12 @@ bridge:
|
||||||
# Note that updating the m.direct event is not atomic (except with mautrix-asmux)
|
# Note that updating the m.direct event is not atomic (except with mautrix-asmux)
|
||||||
# and is therefore prone to race conditions.
|
# and is therefore prone to race conditions.
|
||||||
sync_direct_chat_list: false
|
sync_direct_chat_list: false
|
||||||
# Allow using double puppeting from any server with a valid client .well-known file.
|
# Servers to always allow double puppeting from, even if double_puppet_allow_discovery is false.
|
||||||
double_puppet_allow_discovery: false
|
|
||||||
# Servers to allow double puppeting from, even if double_puppet_allow_discovery is false.
|
|
||||||
double_puppet_server_map:
|
double_puppet_server_map:
|
||||||
example.com: https://example.com
|
example.com: https://example.com
|
||||||
# Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
|
# Allow using double puppeting from any server with a valid client .well-known file.
|
||||||
|
double_puppet_allow_discovery: false
|
||||||
|
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
|
||||||
#
|
#
|
||||||
# If set, custom puppets will be enabled automatically for local users
|
# If set, custom puppets will be enabled automatically for local users
|
||||||
# instead of users having to find an access token and run `login-matrix`
|
# instead of users having to find an access token and run `login-matrix`
|
||||||
|
@ -151,7 +154,7 @@ bridge:
|
||||||
# If using this for other servers than the bridge's server,
|
# If using this for other servers than the bridge's server,
|
||||||
# you must also set the URL in the double_puppet_server_map.
|
# you must also set the URL in the double_puppet_server_map.
|
||||||
login_shared_secret_map:
|
login_shared_secret_map:
|
||||||
example.com: foo
|
example.com: foobar
|
||||||
# Whether or not created rooms should have federation enabled.
|
# Whether or not created rooms should have federation enabled.
|
||||||
# If false, created portal rooms will never be federated.
|
# If false, created portal rooms will never be federated.
|
||||||
federate_rooms: true
|
federate_rooms: true
|
||||||
|
@ -280,9 +283,9 @@ logging:
|
||||||
formatter: colored
|
formatter: colored
|
||||||
loggers:
|
loggers:
|
||||||
mau:
|
mau:
|
||||||
level: __LOG_LEVEL__
|
level: INFO
|
||||||
aiohttp:
|
aiohttp:
|
||||||
level: INFO
|
level: INFO
|
||||||
root:
|
root:
|
||||||
level: __LOG_LEVEL__
|
level: INFO
|
||||||
handlers: [file, console]
|
handlers: [file, console]
|
||||||
|
|
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
A puppeting bridge between Matrix and Signal packaged as a YunoHost service. Messages, notifications (and sometimes media) are bridged between a Signal user and a Matrix user. Currently the Matrix user can NOT invite other Matrix user in a bridged Signal room, so only someone with a Signal account can participate to Signal group conversations. The ["Mautrix-Signal"](https://docs.mau.fi/bridges/python/signal/index.html) bridge consists in a Synapse App Service and relies on postgresql (mysql also possible). Therefore, [Synapse for YunoHost](https://github.com/YunoHost-Apps/synapse_ynh) should be installed beforehand.
|
4
doc/DESCRIPTION_fr.md
Normal file
4
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Une passerelle entre Matrix et Signal empaquetée comme un service YunoHost. Les messages, médias et notifications sont relayées entre un compte Signal et un compte Matrix.
|
||||||
|
La passerelle ["Mautrix-Signal"](https://docs.mau.fi/bridges/python/signal/index.html) consiste en un Service d'Application Matrix-Synapse et repose sur une base-de-données postgresql. C'est pourquoi [Synapse for YunoHost](https://github.com/YunoHost-Apps/synapse_ynh) doit être préalablemnet installé.
|
||||||
|
|
||||||
|
** Attention : sauvegardez et restaurez toujours les deux applications Yunohost matrix-synapse et mautrix_signal en même temps!**
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
## Liste de passerelles publiques
|
## Liste de passerelles publiques
|
||||||
|
|
||||||
* Demandez sur un des salons suivants: #mautrix_yunohost:matrix.fdn.fr or #signal:maunium.net
|
* Demandez sur un des salons suivants: #mautrix_yunohost:matrix.fdn.fr or #signal:maunium.net
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
},
|
},
|
||||||
"version": "0.3.0~ynh1",
|
"version": "0.3.0~ynh1",
|
||||||
"url": "https://github.com/mautrix/signal",
|
"url": "https://github.com/mautrix/signal",
|
||||||
|
"upstream": {
|
||||||
|
"license": "AGPL-3.0-or-later",
|
||||||
|
"userdoc": "https://docs.mau.fi/bridges/python/signal/index.html",
|
||||||
|
"code": "https://github.com/mautrix/signal"
|
||||||
|
},
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Gredin67",
|
"name": "Gredin67",
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
## Problem
|
|
||||||
- *Description of why you made this PR*
|
|
||||||
|
|
||||||
## Solution
|
|
||||||
- *And how do you fix that problem*
|
|
||||||
|
|
||||||
## PR Status
|
|
||||||
- [ ] Code finished.
|
|
||||||
- [ ] Tested with Package_check.
|
|
||||||
- [ ] Fix or enhancement tested.
|
|
||||||
- [ ] Upgrade from last version tested.
|
|
||||||
- [ ] Can be reviewed and tested.
|
|
||||||
|
|
||||||
## Package_check results
|
|
||||||
---
|
|
||||||
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
|
|
||||||
|
|
||||||
[/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/mautrix_signal_ynh%20PR-NUM-%20(USERNAME)/)
|
|
|
@ -4,9 +4,10 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app (must be on a single line)
|
||||||
pkg_dependencies="postgresql python3 python3-dev build-essential libolm-dev"
|
pkg_dependencies="postgresql python3 python3-dev build-essential libolm-dev"
|
||||||
extra_dependencies="libunixsocket-java signald signaldctl"
|
extra_dependencies="libunixsocket-java signald signaldctl"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
### Remove this function if there's nothing to clean before calling the remove script.
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -50,14 +49,13 @@ ynh_backup --src_path="$final_path"
|
||||||
# BACKUP LOGROTATE
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/var/log/$app"
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
#ynh_backup --src_path="/etc/systemd/system/signald.service"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP VARIOUS FILES
|
||||||
|
|
133
scripts/install
133
scripts/install
|
@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
### Remove this function if there's nothing to clean before calling the remove script.
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -24,17 +23,20 @@ ynh_abort_if_errors
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER
|
||||||
botname=$YNH_APP_ARG_BOTNAME
|
botname=$YNH_APP_ARG_BOTNAME
|
||||||
bot_synapse_adm=true
|
bot_synapse_adm=true
|
||||||
#encryption=$YNH_APP_ARG_ENCRYPTION
|
|
||||||
encryption=false
|
encryption=false
|
||||||
botadmin=$YNH_APP_ARG_BOTADMIN
|
botadmin=$YNH_APP_ARG_BOTADMIN
|
||||||
botusers=$YNH_APP_ARG_BOTUSERS
|
botusers=$YNH_APP_ARG_BOTUSERS
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
if [ "$botusers" == "admin" ]
|
if [ "$botusers" == "admin" ]
|
||||||
then
|
then
|
||||||
botusers=$botadmin
|
botusers=$botadmin
|
||||||
fi
|
fi
|
||||||
synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER
|
|
||||||
# ToDo check (in manifest?) if the selected synapse instance is not already connected to a mautrix_bridge bridge
|
# ToDo check (in manifest?) if the selected synapse instance is not already connected to a mautrix_bridge bridge
|
||||||
if [ $synapsenumber -eq "1" ]
|
if [ $synapsenumber -eq "1" ]
|
||||||
then
|
then
|
||||||
|
@ -44,9 +46,11 @@ synapse_instance="synapse__$synapsenumber"
|
||||||
fi
|
fi
|
||||||
server_name=$(ynh_app_setting_get --app $synapse_instance --key server_name)
|
server_name=$(ynh_app_setting_get --app $synapse_instance --key server_name)
|
||||||
domain=$(ynh_app_setting_get --app $synapse_instance --key domain)
|
domain=$(ynh_app_setting_get --app $synapse_instance --key domain)
|
||||||
|
|
||||||
mautrix_version=$(ynh_app_upstream_version)
|
mautrix_version=$(ynh_app_upstream_version)
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
enable_relaybot=true
|
||||||
|
bot_synapse_db_user="@$botname:$server_name"
|
||||||
|
synapse_db_name="matrix_$synapse_instance"
|
||||||
|
signald_user="signald" # This is actually chosen by the signald dependency
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
|
@ -55,31 +59,20 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
||||||
|
|
||||||
final_path=/opt/yunohost/$app
|
final_path=/opt/yunohost/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SET CONSTANTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
enable_relaybot=true
|
|
||||||
bot_synapse_db_user="@$botname:$server_name"
|
|
||||||
synapse_db_name="matrix_$synapse_instance"
|
|
||||||
|
|
||||||
signald_user="signald" # This is actually chosen by the signald dependency
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=7
|
ynh_script_progression --message="Storing installation settings..." --weight=7
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
|
||||||
ynh_app_setting_set --app=$app --key=server_name --value=$server_name
|
|
||||||
ynh_app_setting_set --app=$app --key=botname --value=$botname
|
ynh_app_setting_set --app=$app --key=botname --value=$botname
|
||||||
ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance
|
|
||||||
ynh_app_setting_set --app=$app --key=bot_synapse_adm --value=$bot_synapse_adm
|
ynh_app_setting_set --app=$app --key=bot_synapse_adm --value=$bot_synapse_adm
|
||||||
ynh_app_setting_set --app=$app --key=encryption --value=$encryption
|
ynh_app_setting_set --app=$app --key=encryption --value=$encryption
|
||||||
ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
|
ynh_app_setting_set --app=$app --key=botadmin --value=$botadmin
|
||||||
ynh_app_setting_set --app=$app --key=botusers --value=$botusers
|
ynh_app_setting_set --app=$app --key=botusers --value=$botusers
|
||||||
|
ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance
|
||||||
|
ynh_app_setting_set --app=$app --key=server_name --value=$server_name
|
||||||
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=mautrix_version --value=$mautrix_version
|
ynh_app_setting_set --app=$app --key=mautrix_version --value=$mautrix_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -99,8 +92,6 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=10
|
ynh_script_progression --message="Installing dependencies..." --weight=10
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=10
|
|
||||||
ynh_install_extra_app_dependencies --repo="https://updates.signald.org unstable main" --package="$extra_dependencies" --key="https://updates.signald.org/apt-signing-key.asc"
|
ynh_install_extra_app_dependencies --repo="https://updates.signald.org unstable main" --package="$extra_dependencies" --key="https://updates.signald.org/apt-signing-key.asc"
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
|
@ -113,7 +104,7 @@ ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
# Add the user to the signald group. The signald group was created when the signald
|
# Add the user to the signald group. The signald group was created when the signald
|
||||||
# package was installed from the extra repository
|
# package was installed from the extra repository
|
||||||
# resolved by https://gitlab.com/signald/signald/-/commit/278240f3f1cc40a3b444c958b68ca3d6908e98a8
|
# resolved by https://gitlab.com/signald/signald/-/commit/278240f3f1cc40a3b444c958b68ca3d6908e98a8
|
||||||
ynh_system_user_create --username=$app --groups="$signald_user"
|
ynh_system_user_create --username=$app --home_dir="$final_path" --groups="$signald_user"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
|
@ -121,33 +112,60 @@ ynh_system_user_create --username=$app --groups="$signald_user"
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=3
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=3
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
|
db_user=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
db_pwd=$(ynh_string_random --length=30)
|
|
||||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=3
|
ynh_script_progression --message="Setting up source files..." --weight=3
|
||||||
|
|
||||||
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path/src"
|
ynh_setup_source --dest_dir="$final_path/src"
|
||||||
chmod 750 "$final_path"
|
|
||||||
chown $app:$app "$final_path"
|
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring Mautrix Bridge..." --weight=2
|
ynh_script_progression --message="Adding a configuration file..." --weight=2
|
||||||
|
|
||||||
# https://docs.python.org/3.6/library/logging.html#logging-levels
|
|
||||||
log_level="INFO"
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml"
|
ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml"
|
||||||
chmod -R 750 "$final_path"
|
|
||||||
|
chmod 400 "$final_path/config.yaml"
|
||||||
|
chown $app:$app "$final_path/config.yaml"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL MAUTRIX-BRIDGE PYTHON MODULE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing Mautrix-Bridge Python Module..." --weight=6
|
||||||
|
|
||||||
|
mkdir -p /var/log/$app
|
||||||
|
# Configure Mautrix-Bridge
|
||||||
|
python3 -m venv $final_path
|
||||||
|
export HOME=$final_path
|
||||||
|
$final_path/bin/pip3 install --upgrade pip setuptools wheel
|
||||||
|
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-signal.tar.gz[metrics,e2be,formattednumbers,qrlink,stickers]
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REGISTER SYNAPSE APP-SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Registering Synapse app-service" --weight=1
|
||||||
|
|
||||||
|
$final_path/bin/python3 -m mautrix_signal -g -c $final_path/config.yaml -r /etc/matrix-$synapse_instance/app-service/$app.yaml
|
||||||
|
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || ynh_die --message="Synapse can't restart with the appservice configuration"
|
||||||
|
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$final_path"
|
||||||
|
ynh_store_file_checksum --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
||||||
|
ynh_store_file_checksum --file="$final_path/config.yaml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -157,41 +175,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=3
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL MAUTRIX-BRIDGE PYTHON MODULE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring python3 virtual environment" --weight=6
|
|
||||||
|
|
||||||
mkdir -p /var/log/$app
|
|
||||||
# Configure Mautrix-Bridge
|
|
||||||
python3 -m venv $final_path
|
|
||||||
export HOME=$final_path
|
|
||||||
$final_path/bin/pip3 install --upgrade pip setuptools wheel
|
|
||||||
|
|
||||||
ynh_script_progression --message="Installing Bridge with pip" --weight=6
|
|
||||||
|
|
||||||
# Pre-compiled python-olm to avoid libolm-dev, python3-dev -> does not work for arm
|
|
||||||
#$final_path/bin/pip3 install --upgrade python-olm --extra-index-url https://gitlab.matrix.org/api/v4/projects/27/packages/pypi/simple
|
|
||||||
# Build with libolm3 end-to-bridge encryption
|
|
||||||
$final_path/bin/pip3 install $final_path/src/mautrix-signal.tar.gz[metrics,e2be,formattednumbers,qrlink,stickers]
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REGISTER SYNAPSE APP-SERVICE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
$final_path/bin/python3 -m mautrix_signal -g -c $final_path/config.yaml -r /etc/matrix-$synapse_instance/app-service/$app.yaml
|
|
||||||
|
|
||||||
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|
|
||||||
|| ynh_die "Synapse can't restart with the appservice configuration"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
|
||||||
ynh_store_file_checksum --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
|
||||||
ynh_store_file_checksum --file="$final_path/config.yaml"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -206,10 +189,11 @@ chmod 700 "/var/log/$app"
|
||||||
chown -R $app:$app /var/log/$app
|
chown -R $app:$app /var/log/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
yunohost service add $app --description="Bridging Signal and Matrix messages" --log=/var/log/$app/$app.log
|
|
||||||
|
yunohost service add $app --description="$app daemon for bridging Signal and Matrix messages" --log=/var/log/$app/$app.log
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -217,18 +201,7 @@ yunohost service add $app --description="Bridging Signal and Matrix messages" --
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
sleep 2
|
|
||||||
chown -R $app:$app "$final_path"
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
## Wait until the synapse user is created
|
|
||||||
#sleep 30
|
|
||||||
# # (Note that, by default, non-admins might not have your homeserver's permission to create communities.)
|
|
||||||
# if [ "$bot_synapse_adm" = true ]
|
|
||||||
# then
|
|
||||||
# ynh_psql_execute_as_root --database=$synapse_db_name --sql="UPDATE users SET admin = 1 WHERE name = ""$botname"";"
|
|
||||||
# #yunohost app action run $synapse_instance set_admin_user -a username=$botname
|
|
||||||
# fi
|
|
||||||
#ynh_systemd_action --service_name=$app --action="restart"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -16,19 +16,12 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
|
|
||||||
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
|
||||||
botname=$(ynh_app_setting_get --app=$app --key=botname)
|
botname=$(ynh_app_setting_get --app=$app --key=botname)
|
||||||
botadmin=$(ynh_app_setting_get --app=$app --key=botadmin)
|
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SET CONSTANTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
synapse_db_name="matrix_$synapse_instance"
|
synapse_db_name="matrix_$synapse_instance"
|
||||||
bot_synapse_db_user="@$botname:$server_name"
|
bot_synapse_db_user="@$botname:$server_name"
|
||||||
signald_data="/var/lib/signald"
|
signald_data="/var/lib/signald"
|
||||||
|
@ -38,13 +31,13 @@ signald_user="signald"
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE FROM ADMIN PANEL
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove a service from the admin panel, added by `yunohost service add`
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service..." --weight=3
|
ynh_script_progression --message="Removing $app service integration..." --weight=3
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -56,13 +49,21 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||||
|
|
||||||
|
# Remove the app-specific logrotate config
|
||||||
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
# REMOVE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=4
|
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=4
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_psql_remove_db --db_user=$db_name --db_name=$db_name
|
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$app"";"
|
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$app"";"
|
||||||
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP USER ""$app"";"
|
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP USER ""$app"";"
|
||||||
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$bot_synapse_db_user"";"
|
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$bot_synapse_db_user"";"
|
||||||
|
@ -71,7 +72,14 @@ ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$bot
|
||||||
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP USER ""$botname"";"
|
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP USER ""$botname"";"
|
||||||
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$signald_user"";"
|
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP OWNED BY ""$signald_user"";"
|
||||||
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP USER ""$signald_user"";"
|
ynh_psql_execute_as_root --database=$synapse_db_name --sql="DROP USER ""$signald_user"";"
|
||||||
#yunohost app action run $synapse_instance drop_user -a username=$botname
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||||
|
|
||||||
|
# Remove the app directory securely
|
||||||
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
|
@ -81,34 +89,19 @@ ynh_script_progression --message="Removing dependencies..." --weight=8
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file="$signald_data"
|
|
||||||
ynh_secure_remove --file="$signald_exe"
|
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
|
||||||
ynh_remove_logrotate
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing synapse app service..." --weight=6
|
# REMOVE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing various files..." --weight=6
|
||||||
|
|
||||||
|
ynh_secure_remove --file="$signald_data"
|
||||||
|
ynh_secure_remove --file="$signald_exe"
|
||||||
|
|
||||||
# Remove a directory securely
|
# Remove a directory securely
|
||||||
ynh_secure_remove --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
ynh_secure_remove --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
||||||
|
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || ynh_die --message="Synapse can't restart with the appservice configuration"
|
||||||
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|
|
||||||
|| ynh_die "Synapse can't restart with the appservice configuration"
|
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
|
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
#### Remove this function if there's nothing to clean before calling the remove script.
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -29,7 +28,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
db_user=$db_name
|
||||||
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
|
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
|
||||||
botname=$(ynh_app_setting_get --app=$app --key=botname)
|
botname=$(ynh_app_setting_get --app=$app --key=botname)
|
||||||
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
||||||
|
@ -39,47 +39,30 @@ botusers=$(ynh_app_setting_get --app=$app --key=botusers)
|
||||||
botadmin=$(ynh_app_setting_get --app=$app --key=botadmin)
|
botadmin=$(ynh_app_setting_get --app=$app --key=botadmin)
|
||||||
previous_mautrix_version=$(ynh_app_setting_get --app=$app --key=mautrix_version)
|
previous_mautrix_version=$(ynh_app_setting_get --app=$app --key=mautrix_version)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
|
||||||
|
|
||||||
mautrix_version=$(ynh_app_upstream_version)
|
mautrix_version=$(ynh_app_upstream_version)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SET CONSTANTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
synapse_db_name="matrix_$synapse_instance"
|
synapse_db_name="matrix_$synapse_instance"
|
||||||
bot_synapse_db_user="@$botname:$server_name"
|
bot_synapse_db_user="@$botname:$server_name"
|
||||||
signald_data="/var/lib/signald"
|
signald_data="/var/lib/signald"
|
||||||
#signald_exe="/usr/bin/signald"
|
#signald_exe="/usr/bin/signald"
|
||||||
|
signald_user="signald" # This is actually chosen by the signald dependency
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
test ! -d $final_path \
|
||||||
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
# libolm-dev avoided by pre-compiled python-olm
|
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies --repo="https://updates.signald.org unstable main" --package="$extra_dependencies" --key="https://updates.signald.org/apt-signing-key.asc"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
|
@ -88,49 +71,65 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE USER RIGHTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Restore permissions on app files
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chown $app:$app "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chmod -R 750 "$final_path"
|
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://updates.signald.org unstable main" --package="$extra_dependencies" --key="https://updates.signald.org/apt-signing-key.asc"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path" --groups="$signald_user"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=8
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=8
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
||||||
#ynh_psql_execute_as_root --sql="CREATE DATABASE ""$db_name"" ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER ""$dbname"";"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# INSTALL MAUTRIX-BRIDGE PYTHON MODULE
|
||||||
#=================================================
|
|
||||||
# RESTORE MAUTRIX-BRIDGE PYTHON MODULE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing Mautrix-Bridge Python Module..." --weight=6
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/var/log/$app"
|
mkdir -p /var/log/$app
|
||||||
#mkdir -p /var/log/$app
|
|
||||||
# Configure Mautrix-Bridge
|
# Configure Mautrix-Bridge
|
||||||
python3 -m venv $final_path
|
python3 -m venv $final_path
|
||||||
export HOME=$final_path
|
export HOME=$final_path
|
||||||
$final_path/bin/pip3 install --upgrade pip setuptools wheel
|
$final_path/bin/pip3 install --upgrade pip setuptools wheel
|
||||||
|
|
||||||
# Pre-compiled python-olm to avoid libolm-dev, python3-dev
|
|
||||||
#$final_path/bin/pip3 install --upgrade python-olm --extra-index-url https://gitlab.matrix.org/api/v4/projects/27/packages/pypi/simple
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REGISTER SYNAPSE APP-SERVICE
|
# REGISTER SYNAPSE APP-SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Registering Synapse app-service" --weight=1
|
||||||
|
|
||||||
$final_path/bin/python3 -m mautrix_signal -g -c $final_path/config.yaml -r /etc/matrix-$synapse_instance/app-service/$app.yaml
|
$final_path/bin/python3 -m mautrix_signal -g -c $final_path/config.yaml -r /etc/matrix-$synapse_instance/app-service/$app.yaml
|
||||||
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || ynh_die "Synapse can't restart with the appservice configuration"
|
||||||
|| ynh_die "Synapse can't restart with the appservice configuration"
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=signald --action="stop"
|
||||||
|
ynh_restore_file --origin_path="$signald_data"
|
||||||
|
ynh_systemd_action --service_name=signald --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
|
@ -143,26 +142,16 @@ systemctl enable $app.service --quiet
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||||
|
|
||||||
ynh_use_logrotate
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
chmod -R 600 "/var/log/$app"
|
|
||||||
chmod 700 "/var/log/$app"
|
|
||||||
chown -R $app:$app /var/log/$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="Bridging Signal and Matrix messages" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="$app daemon for bridging Signal and Matrix messages" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=signald --action="stop"
|
|
||||||
ynh_restore_file --origin_path="$signald_data"
|
|
||||||
ynh_systemd_action --service_name=signald --action="start"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
148
scripts/upgrade
148
scripts/upgrade
|
@ -16,38 +16,28 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
botname=$(ynh_app_setting_get --app=$app --key=botname)
|
botname=$(ynh_app_setting_get --app=$app --key=botname)
|
||||||
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
|
||||||
encryption=$(ynh_app_setting_get --app=$app --key=encryption)
|
encryption=$(ynh_app_setting_get --app=$app --key=encryption)
|
||||||
botusers=$(ynh_app_setting_get --app=$app --key=botusers)
|
|
||||||
botadmin=$(ynh_app_setting_get --app=$app --key=botadmin)
|
botadmin=$(ynh_app_setting_get --app=$app --key=botadmin)
|
||||||
|
botusers=$(ynh_app_setting_get --app=$app --key=botusers)
|
||||||
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
previous_mautrix_version=$(ynh_app_setting_get --app=$app --key=mautrix_version)
|
previous_mautrix_version=$(ynh_app_setting_get --app=$app --key=mautrix_version)
|
||||||
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
db_user=$db_name
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
|
||||||
|
server_name=$(ynh_app_setting_get --app=$app --key=server_name)
|
||||||
mautrix_version=$(ynh_app_upstream_version)
|
mautrix_version=$(ynh_app_upstream_version)
|
||||||
signald_user="signald" # This is actually chosen by the signald dependency
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SET CONSTANTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
enable_relaybot=true
|
|
||||||
# https://docs.python.org/3.6/library/logging.html#logging-levels
|
|
||||||
log_level="INFO"
|
|
||||||
#log_format="$app.log"
|
|
||||||
|
|
||||||
synapse_db_name="matrix_$synapse_instance"
|
synapse_db_name="matrix_$synapse_instance"
|
||||||
bot_synapse_db_user="@$botname:$server_name"
|
signald_user="signald" # This is actually chosen by the signald dependency
|
||||||
|
enable_relaybot=true
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking version..." --weight=1
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
@ -72,16 +62,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies --repo="https://updates.signald.org unstable main" --package="$extra_dependencies" --key="https://updates.signald.org/apt-signing-key.asc"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -115,7 +96,7 @@ chmod -R g+rwX /var/lib/signald/{avatars,attachments,stickers}
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app --home_dir="$final_path" --groups="$signald_user"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -127,28 +108,56 @@ then
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path/src"
|
ynh_setup_source --dest_dir="$final_path/src"
|
||||||
chmod 750 $final_path
|
|
||||||
chown $app:$app $final_path
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
chmod 750 "$final_path"
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
chmod -R o-rwx "$final_path"
|
||||||
#=================================================
|
|
||||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
|
||||||
ynh_backup_if_checksum_is_different --file="$final_path/config.yaml"
|
|
||||||
ynh_backup_if_checksum_is_different --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPDATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring Mautrix Bridge..." --weight=2
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml"
|
|
||||||
chmod -R 750 "$final_path"
|
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
#================================================
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||||
|
|
||||||
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
ynh_install_extra_app_dependencies --repo="https://updates.signald.org unstable main" --package="$extra_dependencies" --key="https://updates.signald.org/apt-signing-key.asc"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
# UPDATE A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating a configuration file..." --weight=2
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/config.yaml" --destination="$final_path/config.yaml"
|
||||||
|
|
||||||
|
chmod 400 "$final_path/config.yaml"
|
||||||
|
chown $app:$app "$final_path/config.yaml"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE MAUTRIX-BRIDGE PYTHON MODULE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading Mautrix-Bridge Python Module..." --weight=2
|
||||||
|
|
||||||
|
python3 -m venv $final_path
|
||||||
|
export HOME=$final_path
|
||||||
|
$final_path/bin/pip3 install --upgrade pip setuptools wheel
|
||||||
|
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-signal.tar.gz[metrics,e2be,formattednumbers,qrlink,stickers]
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REGISTER SYNAPSE APP-SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Registering Synapse app-service" --weight=1
|
||||||
|
|
||||||
|
$final_path/bin/python3 -m mautrix_signal -g -c $final_path/config.yaml -r /etc/matrix-$synapse_instance/app-service/$app.yaml
|
||||||
|
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || ynh_die "Synapse can't restart with the appservice configuration"
|
||||||
|
|
||||||
|
# Set permissions on app files
|
||||||
|
chown -R $app:$app "$final_path"
|
||||||
|
ynh_store_file_checksum --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
||||||
|
ynh_store_file_checksum --file="$final_path/config.yaml"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=4
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=4
|
||||||
|
@ -156,40 +165,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=4
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE MAUTRIX-BRIDGE PYTHON MODULE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading python3 virtual environment" --weight=6
|
|
||||||
|
|
||||||
mkdir -p /var/log/$app
|
|
||||||
# Configure Mautrix-Bridge
|
|
||||||
python3 -m venv $final_path
|
|
||||||
export HOME=$final_path
|
|
||||||
$final_path/bin/pip3 install --upgrade pip setuptools wheel
|
|
||||||
|
|
||||||
ynh_script_progression --message="Installing with pip" --weight=6
|
|
||||||
|
|
||||||
# Pre-compiled python-olm to avoid libolm-dev, python3-dev -> does not work for arm
|
|
||||||
#$final_path/bin/pip3 install --upgrade python-olm --extra-index-url https://gitlab.matrix.org/api/v4/projects/27/packages/pypi/simple
|
|
||||||
# Build with libolm3 end-to-bridge encryption
|
|
||||||
$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-signal.tar.gz[metrics,e2be,formattednumbers,qrlink,stickers]
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REGISTER SYNAPSE APP-SERVICE
|
|
||||||
#=================================================
|
|
||||||
$final_path/bin/python3 -m mautrix_signal -g -c $final_path/config.yaml -r /etc/matrix-$synapse_instance/app-service/$app.yaml
|
|
||||||
|
|
||||||
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \
|
|
||||||
|| ynh_die "Synapse can't restart with the appservice configuration"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
|
||||||
ynh_store_file_checksum --file="$final_path/config.yaml"
|
|
||||||
ynh_store_file_checksum --file="/etc/matrix-$synapse_instance/app-service/$app.yaml"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -197,7 +172,7 @@ ynh_store_file_checksum --file="/etc/matrix-$synapse_instance/app-service/$app.y
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
chmod -R 600 "/var/log/$app"
|
chmod -R 600 "/var/log/$app"
|
||||||
chmod 700 "/var/log/$app"
|
chmod 700 "/var/log/$app"
|
||||||
|
@ -208,15 +183,14 @@ chown -R $app:$app /var/log/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="Bridging Signal and Matrix messages" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="$app daemon for bridging Signal and Matrix messages" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
sleep 2
|
# Start a systemd service
|
||||||
chown -R $app:$app "$final_path"
|
|
||||||
ynh_systemd_action --service_name=$app --action="start"
|
ynh_systemd_action --service_name=$app --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
Loading…
Add table
Reference in a new issue