From 2a9127927dc2e79e6566774f304db7d14cf9b7c2 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 29 May 2022 11:37:14 +0200 Subject: [PATCH 01/15] FIX: ynh_die should have --message argument --- scripts/install | 4 ++-- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 023c7dc..4b97eee 100755 --- a/scripts/install +++ b/scripts/install @@ -35,7 +35,7 @@ synapse_config_path="/etc/matrix-$synapse_instance" # Check Synapse is installed or die early if [ ! -d $synapse_config_path ] then - ynh_die "Could not find $synapse_config_path config directory. Ensure that you installed Matrix Synapse first and that you entered a correct \"synapse instance number\"" + ynh_die --message="Could not find $synapse_config_path config directory. Ensure that you installed Matrix Synapse first and that you entered a correct \"synapse instance number\"" fi server_name=$(ynh_app_setting_get --app $synapse_instance --key server_name) @@ -195,7 +195,7 @@ popd cp "$final_path/$app.yaml" $app_service_registration_path/$app.yaml /opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ - || ynh_die "Synapse can't restart with the appservice configuration" + || ynh_die --message="Synapse can't restart with the appservice configuration" #================================================= # STORE THE CONFIG FILE CHECKSUM diff --git a/scripts/restore b/scripts/restore index 95c627a..6f2e6fc 100755 --- a/scripts/restore +++ b/scripts/restore @@ -105,7 +105,7 @@ chown $app:$app "$etc_path/user.config.yaml" #================================================= cp "$final_path/$app.yaml" $app_service_registration_path/$app.yaml /opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ - || ynh_die "Synapse can't restart with the appservice configuration" + || ynh_die --message="Synapse can't restart with the appservice configuration" #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 5c8e940..38108ef 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -193,7 +193,7 @@ popd cp "$final_path/$app.yaml" $app_service_registration_path/$app.yaml /opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ - || ynh_die "Synapse can't restart with the appservice configuration" + || ynh_die --message="Synapse can't restart with the appservice configuration" #================================================= # END OF SCRIPT From 20e456a8ecb12a190f5719ce7829d60e0db88af0 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 10 Jun 2022 17:58:54 +0000 Subject: [PATCH 02/15] Auto-update README --- README.md | 1 - README_fr.md | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index ef90104..4dc2c4f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ See for documentation. **Shipped version:** 0.1.6~ynh2 - ## Screenshots ![Screenshot of Matrix-Discord bridge](./doc/screenshots/example.jpg) diff --git a/README_fr.md b/README_fr.md index 3339508..2fbec1b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -40,8 +40,7 @@ Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée Voir la documentation sur (en anglais). -**Version incluse :** 0.1.6~ynh2 - +**Version incluse :** 0.1.6~ynh2 ## Captures d'écran From 7a43842e22b60c66d2380ee215e115069c355901 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 29 May 2022 14:21:21 +0200 Subject: [PATCH 03/15] Bump to version 0.1.7 --- conf/app.src | 4 ++-- manifest.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/app.src b/conf/app.src index 50c7c3f..f19cdf8 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/matrix-discord/mx-puppet-discord/archive/bb6438a504182a7a64048b992179427587ccfded.tar.gz -SOURCE_SUM=850e2ed4ca236bdae3409f8ccb59b3ebbf00e07be65990f8b00019e9732ced26 +SOURCE_URL=https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/master/mx-puppet-discord-master.tar.gz +SOURCE_SUM=3e774c0a7fe02ba92fb2b2e45edb5601e85dfe1a164cba20b60050bfdcb9c77f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 7edd38b..858256c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,13 +6,13 @@ "en": "A Discord puppeting bridge for Matrix/Synapse.", "fr": "Passerelle Discord pour Matrix/Synapse." }, - "version": "0.1.6~ynh2", + "version": "0.1.7~ynh1", "url": "https://github.com/matrix-discord/mx-puppet-discord", "upstream": { "license": " Apache-2.0", - "website": "https://github.com/matrix-discord/mx-puppet-discord", - "admindoc": "https://github.com/matrix-discord/mx-puppet-discord", - "code": "https://github.com/matrix-discord/mx-puppet-discord" + "website": "https://gitlab.com/mx-puppet/discord/mx-puppet-discord", + "admindoc": "https://gitlab.com/mx-puppet/discord/mx-puppet-discord", + "code": "https://gitlab.com/mx-puppet/discord/mx-puppet-discord" }, "license": "Apache-2.0", "maintainer": { From 8b2635fb0b0c177a078eaff990ded1b592540573 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 29 May 2022 14:22:39 +0200 Subject: [PATCH 04/15] Update README --- README.md | 8 ++++---- README_fr.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4dc2c4f..105397f 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ This is a discord puppeting bridge for matrix. It handles bridging private and g See for documentation. -**Shipped version:** 0.1.6~ynh2 +**Shipped version:** 0.1.7~ynh1 ## Screenshots @@ -54,9 +54,9 @@ You also may modify the `/etc/matrix-puppet-discord/user.config.yaml` file to cu ## Documentation and resources -* Official app website: -* Official admin documentation: -* Upstream app code repository: +* Official app website: +* Official admin documentation: +* Upstream app code repository: * YunoHost documentation for this app: * Report a bug: diff --git a/README_fr.md b/README_fr.md index 2fbec1b..19f6692 100644 --- a/README_fr.md +++ b/README_fr.md @@ -40,7 +40,7 @@ Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée Voir la documentation sur (en anglais). -**Version incluse :** 0.1.6~ynh2 +**Version incluse :** 0.1.7~ynh1 ## Captures d'écran @@ -54,9 +54,9 @@ Vous pouvez par ailleurs modifier le fichier `/etc/matrix-puppet-discord/user.co ## Documentations et ressources -* Site officiel de l'app : -* Documentation officielle de l'admin : -* Dépôt de code officiel de l'app : +* Site officiel de l'app : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : * Documentation YunoHost pour cette app : * Signaler un bug : From 45f2755c9be524688da316d4de13ef3d6f8e02a1 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 29 May 2022 19:43:51 +0200 Subject: [PATCH 05/15] Fix app.src with commit hash instead of branch --- conf/app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index f19cdf8..64b42fb 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,4 +1,4 @@ -SOURCE_URL=https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/master/mx-puppet-discord-master.tar.gz +SOURCE_URL=https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/3c82530ac4978ae206f63634a319523e5bff299a/mx-puppet-discord-master.tar.gz SOURCE_SUM=3e774c0a7fe02ba92fb2b2e45edb5601e85dfe1a164cba20b60050bfdcb9c77f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz From c6c5c2a893f928390eef9c1c85211c4211112b6b Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 29 May 2022 22:17:59 +0200 Subject: [PATCH 06/15] Add step for yq installation --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 4b97eee..afd9e2f 100755 --- a/scripts/install +++ b/scripts/install @@ -130,6 +130,7 @@ popd # SETUP PIP (FOR YQ) #================================================= +ynh_script_progression --message="Install yq..." --weight=1 pip_path=$final_path/.pip python3 -m venv $pip_path $pip_path/bin/pip3 install yq From c6788aa8641549dc3530f5eed75c6df8401edafd Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 29 May 2022 22:24:57 +0200 Subject: [PATCH 07/15] Upgrade to latest main --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index 64b42fb..11fb0a6 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/3c82530ac4978ae206f63634a319523e5bff299a/mx-puppet-discord-master.tar.gz -SOURCE_SUM=3e774c0a7fe02ba92fb2b2e45edb5601e85dfe1a164cba20b60050bfdcb9c77f +SOURCE_URL=https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/fd4402268e9a8b942ca632f3337702862e06d24f/mx-puppet-discord-fd4402268e9a8b942ca632f3337702862e06d24f.tar.gz +SOURCE_SUM=b0edc4dfe9d3670eb8b53dc229a8fd7fb794ada5fe1f3d3ba4c38b54ce5ca176 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From f9679ea2ff5fbfc3a76a7cf1c90fd2d57f747e91 Mon Sep 17 00:00:00 2001 From: Florent Date: Fri, 3 Jun 2022 11:21:46 +0200 Subject: [PATCH 08/15] Revert "Upgrade to latest main" This reverts commit a407d373e40d8f240fbf260425a703f2dc310659. --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index 11fb0a6..64b42fb 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/fd4402268e9a8b942ca632f3337702862e06d24f/mx-puppet-discord-fd4402268e9a8b942ca632f3337702862e06d24f.tar.gz -SOURCE_SUM=b0edc4dfe9d3670eb8b53dc229a8fd7fb794ada5fe1f3d3ba4c38b54ce5ca176 +SOURCE_URL=https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/3c82530ac4978ae206f63634a319523e5bff299a/mx-puppet-discord-master.tar.gz +SOURCE_SUM=3e774c0a7fe02ba92fb2b2e45edb5601e85dfe1a164cba20b60050bfdcb9c77f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From 63b8535a952dc31261ffdfccd91e25634d1a320a Mon Sep 17 00:00:00 2001 From: Florent Date: Fri, 3 Jun 2022 11:24:51 +0200 Subject: [PATCH 09/15] Fix sha256sum --- conf/app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index 64b42fb..841eef9 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ SOURCE_URL=https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/3c82530ac4978ae206f63634a319523e5bff299a/mx-puppet-discord-master.tar.gz -SOURCE_SUM=3e774c0a7fe02ba92fb2b2e45edb5601e85dfe1a164cba20b60050bfdcb9c77f +SOURCE_SUM=df351ace3788ad9c2d932bcdfc0ba691cd071575d7bd0f9180fbe6976dca5c42 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From 660cf41a0ceac6457a2f9703ac19698232cd9b34 Mon Sep 17 00:00:00 2001 From: Florent Date: Fri, 3 Jun 2022 11:25:02 +0200 Subject: [PATCH 10/15] Allow download from git+ssh and use node 16 --- scripts/_common.sh | 2 +- scripts/install | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ee8ef00..4a28303 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ # dependencies used by the app pkg_dependencies="postgresql" # Node version -NODEJS_VERSION=14 +NODEJS_VERSION=16 #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index afd9e2f..781286f 100755 --- a/scripts/install +++ b/scripts/install @@ -123,7 +123,7 @@ ynh_script_progression --message="Building Node dependencies..." --weight=30 pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH npm install + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new' npm install popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 38108ef..f49b530 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -133,7 +133,7 @@ ynh_script_progression --message="Building Node dependencies..." --weight=3 pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH npm install + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new' npm install popd #================================================= From d2b637db9d43bcd2490b8a63cefe081df066f903 Mon Sep 17 00:00:00 2001 From: Florent Date: Fri, 3 Jun 2022 12:12:02 +0200 Subject: [PATCH 11/15] Cannot test from previous hash anymore, remove an upgrade step --- check_process | 4 ---- 1 file changed, 4 deletions(-) diff --git a/check_process b/check_process index 8e258a6..c19342e 100644 --- a/check_process +++ b/check_process @@ -20,13 +20,9 @@ setup_private=0 setup_public=0 upgrade=1 - upgrade=1 from_commit=1cdeb9f003f07c4df897f29dd4a521c595327415 backup_restore=1 multi_instance=1 port_already_use=1 change_url=0 actions=0 config_panel=0 -;;; Upgrade options - ; commit=1cdeb9f003f07c4df897f29dd4a521c595327415 - name=Documentation From b40231daf387fdd95bc9d8d2e30e59c072ee80c9 Mon Sep 17 00:00:00 2001 From: Florent Date: Fri, 3 Jun 2022 12:43:54 +0200 Subject: [PATCH 12/15] Update upstream links in documentation and manifest --- README.md | 4 ++-- README_fr.md | 4 ++-- doc/DESCRIPTION.md | 4 ++-- doc/DESCRIPTION_fr.md | 4 ++-- manifest.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 105397f..34096c2 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -This is a discord puppeting bridge for matrix. It handles bridging private and group DMs, as well as Guilds (servers). It is based on [mx-puppet-bridge](https://github.com/Sorunome/mx-puppet-bridge). +This is a discord puppeting bridge for matrix. It handles bridging private and group DMs, as well as Guilds (servers). It is based on [mx-puppet-bridge](https://gitlab.com/mx-puppet/mx-puppet-bridge). ### Features @@ -37,7 +37,7 @@ This is a discord puppeting bridge for matrix. It handles bridging private and g ### How to -See for documentation. +See for documentation. **Shipped version:** 0.1.7~ynh1 diff --git a/README_fr.md b/README_fr.md index 19f6692..82f8381 100644 --- a/README_fr.md +++ b/README_fr.md @@ -15,7 +15,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée ou en groupe, tout comme la discussion dans une guilde (serveur Discord). Le projet est basé sur [mx-puppet-bridge](https://github.com/Sorunome/mx-puppet-bridge). +Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée ou en groupe, tout comme la discussion dans une guilde (serveur Discord). Le projet est basé sur [mx-puppet-bridge](https://gitlab.com/mx-puppet/mx-puppet-bridge). ### Fonctionnalités @@ -37,7 +37,7 @@ Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée ### Comment faire -Voir la documentation sur (en anglais). +Voir la documentation sur (en anglais). **Version incluse :** 0.1.7~ynh1 diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 38fec45..f453be2 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,4 +1,4 @@ -This is a discord puppeting bridge for matrix. It handles bridging private and group DMs, as well as Guilds (servers). It is based on [mx-puppet-bridge](https://github.com/Sorunome/mx-puppet-bridge). +This is a discord puppeting bridge for matrix. It handles bridging private and group DMs, as well as Guilds (servers). It is based on [mx-puppet-bridge](https://gitlab.com/mx-puppet/mx-puppet-bridge). ### Features @@ -20,4 +20,4 @@ This is a discord puppeting bridge for matrix. It handles bridging private and g ### How to -See for documentation. +See for documentation. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index 4d0e72e..fc6646d 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1,4 +1,4 @@ -Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée ou en groupe, tout comme la discussion dans une guilde (serveur Discord). Le projet est basé sur [mx-puppet-bridge](https://github.com/Sorunome/mx-puppet-bridge). +Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée ou en groupe, tout comme la discussion dans une guilde (serveur Discord). Le projet est basé sur [mx-puppet-bridge](https://gitlab.com/mx-puppet/mx-puppet-bridge). ### Fonctionnalités @@ -20,4 +20,4 @@ Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée ### Comment faire -Voir la documentation sur (en anglais). +Voir la documentation sur (en anglais). diff --git a/manifest.json b/manifest.json index 858256c..b460d01 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "fr": "Passerelle Discord pour Matrix/Synapse." }, "version": "0.1.7~ynh1", - "url": "https://github.com/matrix-discord/mx-puppet-discord", + "url": "https://gitlab.com/mx-puppet/discord/mx-puppet-discord", "upstream": { "license": " Apache-2.0", "website": "https://gitlab.com/mx-puppet/discord/mx-puppet-discord", From b146e7cc5ab4965b01514d062645ce7680691e12 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 25 Jul 2022 03:40:05 +0200 Subject: [PATCH 13/15] Apply example_ynh --- check_process | 8 +-- conf/app.src | 4 +- {sources/extra_files/app => conf}/run.sh | 0 manifest.json | 4 +- scripts/backup | 9 +-- scripts/install | 65 ++++++++++---------- scripts/remove | 16 ++--- scripts/restore | 5 +- scripts/upgrade | 75 +++++++----------------- sources/extra_files/app/.gitignore | 2 - 10 files changed, 73 insertions(+), 115 deletions(-) rename {sources/extra_files/app => conf}/run.sh (100%) delete mode 100644 sources/extra_files/app/.gitignore diff --git a/check_process b/check_process index c19342e..c78054a 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,3 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; pre-install sudo yunohost tools update apps @@ -26,3 +21,6 @@ change_url=0 actions=0 config_panel=0 +;;; Options +Email= +Notification=none diff --git a/conf/app.src b/conf/app.src index 841eef9..3b2ad45 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,5 +3,5 @@ SOURCE_SUM=df351ace3788ad9c2d932bcdfc0ba691cd071575d7bd0f9180fbe6976dca5c42 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -# SOURCE_FILENAME= -# SOURCE_EXTRACT=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/sources/extra_files/app/run.sh b/conf/run.sh similarity index 100% rename from sources/extra_files/app/run.sh rename to conf/run.sh diff --git a/manifest.json b/manifest.json index b460d01..1aa8766 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A Discord puppeting bridge for Matrix/Synapse.", "fr": "Passerelle Discord pour Matrix/Synapse." }, - "version": "0.1.7~ynh1", + "version": "0.1.7~ynh2", "url": "https://gitlab.com/mx-puppet/discord/mx-puppet-discord", "upstream": { "license": " Apache-2.0", @@ -27,7 +27,7 @@ "postgresql" ], "arguments": { - "install" : [ + "install": [ { "name": "synapsenumber", "type": "string", diff --git a/scripts/backup b/scripts/backup index e6d9fca..0a2ec9c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -34,11 +35,6 @@ etc_path=$(ynh_app_setting_get --app=$app --key=etc_path) #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -63,9 +59,6 @@ ynh_backup --src_path="$etc_path" #================================================= ynh_print_info --message="Backing up the PostgreSql database..." -### (However, things like PostgreSql dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - ynh_psql_dump_db --database="$db_name" > db.sql #================================================= diff --git a/scripts/install b/scripts/install index 781286f..161c6cf 100755 --- a/scripts/install +++ b/scripts/install @@ -13,29 +13,34 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= -# SET CONSTANTS +# RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -app=$YNH_APP_INSTANCE_NAME -final_path=/opt/yunohost/$app synapsenumber=$YNH_APP_ARG_SYNAPSENUMBER +app=$YNH_APP_INSTANCE_NAME + +final_path=/opt/yunohost/$app + if [ $synapsenumber -eq "1" ] then - synapse_instance="synapse" + synapse_instance="synapse" else - synapse_instance="synapse__$synapsenumber" + synapse_instance="synapse__$synapsenumber" fi synapse_config_path="/etc/matrix-$synapse_instance" # Check Synapse is installed or die early if [ ! -d $synapse_config_path ] then - ynh_die --message="Could not find $synapse_config_path config directory. Ensure that you installed Matrix Synapse first and that you entered a correct \"synapse instance number\"" + ynh_die --message="Could not find $synapse_config_path config directory. Ensure that you installed Matrix Synapse first and that you entered a correct \"synapse instance number\"" fi server_name=$(ynh_app_setting_get --app $synapse_instance --key server_name) @@ -69,11 +74,6 @@ ynh_app_setting_set --app=$app --key=synapse_instance --value=$synapse_instance #================================================= ynh_script_progression --message="Finding an available port..." --weight=1 -### Use these lines if you have to open a port for the application -### `ynh_find_port` will find the first available port starting from the given port. -### If you're not using these lines: -### - Remove the section "CLOSE A PORT" in the remove script - # Find an available port port=$(ynh_find_port --port=8434) ynh_app_setting_set --app=$app --key=port --value=$port @@ -110,6 +110,7 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" @@ -122,15 +123,15 @@ chown -R $app:$app "$final_path" ynh_script_progression --message="Building Node dependencies..." --weight=30 pushd "$final_path" - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new' npm install + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new' npm install popd #================================================= # SETUP PIP (FOR YQ) #================================================= - ynh_script_progression --message="Install yq..." --weight=1 + pip_path=$final_path/.pip python3 -m venv $pip_path $pip_path/bin/pip3 install yq @@ -163,7 +164,7 @@ chown $app:$app "$user_config_path" ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create startup script -ynh_add_config --template="../sources/extra_files/app/run.sh" --destination="$final_path/run.sh" +ynh_add_config --template="../conf/run.sh" --destination="$final_path/run.sh" chmod 750 "$final_path/run.sh" chown "$app:$app" "$final_path/run.sh" @@ -171,47 +172,36 @@ chown "$app:$app" "$final_path/run.sh" # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description "$app daemon for bridging Discord and Matrix messages" - #================================================= # CREATE LOG DIR #================================================= + mkdir -p -m 700 "$log_path" chown $app:$app "$log_path" - #================================================= # REGISTER MODULE IN SYNAPSE #================================================= ynh_script_progression --message="Register module in Synapse" --weight=1 pushd "$final_path" - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $final_path/run.sh -r -f "$app.yaml" + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $final_path/run.sh -r -f "$app.yaml" popd cp "$final_path/$app.yaml" $app_service_registration_path/$app.yaml /opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ - || ynh_die --message="Synapse can't restart with the appservice configuration" + || ynh_die --message="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="$app_service_registration_path/$app.yaml" - #================================================= -# SEND A README FOR THE ADMIN +# GENERIC FINALIZATION #================================================= -ynh_script_progression --message="Sending a readme for the admin..." +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -# ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install' +yunohost service add $app --description "$app daemon for bridging Discord and Matrix messages" #================================================= # START SYSTEMD SERVICE @@ -221,6 +211,13 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" +#================================================= +# SEND A README FOR THE ADMIN +#================================================= +ynh_script_progression --message="Sending a readme for the admin..." + +# ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install' + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 5f50d04..4610249 100755 --- a/scripts/remove +++ b/scripts/remove @@ -53,6 +53,14 @@ ynh_script_progression --message="Removing the PostgresSql database..." --weight # Remove a database if it exists, along with the associated user ynh_psql_remove_db --db_user=$db_user --db_name=$db_name +#================================================= +# 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 #================================================= @@ -63,14 +71,6 @@ ynh_remove_nodejs # Remove metapackage and its 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="$final_path" - #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index 6f2e6fc..89791e3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -105,7 +108,7 @@ chown $app:$app "$etc_path/user.config.yaml" #================================================= cp "$final_path/$app.yaml" $app_service_registration_path/$app.yaml /opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ - || ynh_die --message="Synapse can't restart with the appservice configuration" + || ynh_die --message="Synapse can't restart with the appservice configuration" #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index f49b530..bb7e72a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,11 +18,11 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -port=$(ynh_app_setting_get --app=$app --key=port) +language=$(ynh_app_setting_get --app=$app --key=language) admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +port=$(ynh_app_setting_get --app=$app --key=port) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance) @@ -35,13 +35,8 @@ app_service_registration_path=$(ynh_app_setting_get --app=$app --key=app_service #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) #================================================= @@ -52,6 +47,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Restore it if the upgrade fails ynh_restore_upgradebackup } @@ -72,27 +68,6 @@ ynh_systemd_action --service_name=$app --action="stop" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# -# N.B. : the followings setting migrations snippets are provided as *EXAMPLES* -# of what you may want to do in some cases (e.g. a setting was not defined on -# some legacy installs and you therefore want to initiaze stuff during upgrade) -# - -# If db_name doesn't exist, create it -#if [ -z "$db_name" ]; then -# db_name=$(ynh_sanitize_dbid --db_name=$app) -# ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#fi - -# If final_path doesn't exist, create it -#if [ -z "$final_path" ]; then -# final_path=/var/www/$app -# ynh_app_setting_set --app=$app --key=final_path --value=$final_path -#fi - -### If nobody installed your app before 4.1, -### then you may safely remove these lines - #================================================= # CREATE DEDICATED USER #================================================= @@ -107,10 +82,10 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=1 + ynh_script_progression --message="Upgrading source files..." --weight=1 - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep="run.sh" + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" --keep="run.sh" fi chmod 750 "$final_path" @@ -128,12 +103,11 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION #================================================= # INSTALL NODE DEPENDENCIES #================================================= - ynh_script_progression --message="Building Node dependencies..." --weight=3 pushd "$final_path" - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new' npm install + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new' npm install popd #================================================= @@ -143,16 +117,23 @@ popd #================================================= ynh_script_progression --message="Updating configuration files..." --weight=1 -### Same as during install -### -### The file will automatically be backed-up if it's found to be manually modified (because -### ynh_add_config keeps track of the file's checksum) - base_config_path="$final_path/base.config.yaml" ynh_add_config --template="base.config.yaml" --destination="$base_config_path" chmod 400 "$base_config_path" chown $app:$app "$base_config_path" +#================================================= +# REGISTER MODULE IN SYNAPSE +#================================================= + +pushd "$final_path" + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $final_path/run.sh -r -f "$app.yaml" +popd + +cp "$final_path/$app.yaml" $app_service_registration_path/$app.yaml +/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ + || ynh_die --message="Synapse can't restart with the appservice configuration" + #================================================= # SETUP SYSTEMD #================================================= @@ -169,7 +150,7 @@ ynh_add_systemd_config ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 # Create startup script -ynh_add_config --template="../sources/extra_files/app/run.sh" --destination="$final_path/run.sh" +ynh_add_config --template="../conf/run.sh" --destination="$final_path/run.sh" chmod 750 "$final_path/run.sh" chown "$app:$app" "$final_path/run.sh" @@ -183,18 +164,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" -#================================================= -# REGISTER MODULE IN SYNAPSE -#================================================= - -pushd "$final_path" - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $final_path/run.sh -r -f "$app.yaml" -popd - -cp "$final_path/$app.yaml" $app_service_registration_path/$app.yaml -/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh \ - || ynh_die --message="Synapse can't restart with the appservice configuration" - #================================================= # END OF SCRIPT #================================================= diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/extra_files/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] From 964f5cd7dbe86f266e37e15aedd09e8303b198c1 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 25 Jul 2022 01:40:10 +0000 Subject: [PATCH 14/15] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 34096c2..8dfc79e 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ This is a discord puppeting bridge for matrix. It handles bridging private and g See for documentation. -**Shipped version:** 0.1.7~ynh1 +**Shipped version:** 0.1.7~ynh2 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 82f8381..2b491df 100644 --- a/README_fr.md +++ b/README_fr.md @@ -40,7 +40,7 @@ Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée Voir la documentation sur (en anglais). -**Version incluse :** 0.1.7~ynh1 +**Version incluse :** 0.1.7~ynh2 ## Captures d'écran From f2b4c83b9762716908ad7fa0fd21eb748cdca9c2 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 14 Aug 2022 08:38:52 +0000 Subject: [PATCH 15/15] Auto-update README --- README.md | 1 + README_fr.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8dfc79e..dbbbbea 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ See for documentation. **Shipped version:** 0.1.7~ynh2 + ## Screenshots ![Screenshot of Matrix-Discord bridge](./doc/screenshots/example.jpg) diff --git a/README_fr.md b/README_fr.md index 2b491df..a25bc06 100644 --- a/README_fr.md +++ b/README_fr.md @@ -40,7 +40,8 @@ Ceci est une passerelle vers Discord pour Matrix. Il gère la messagerie privée Voir la documentation sur (en anglais). -**Version incluse :** 0.1.7~ynh2 +**Version incluse :** 0.1.7~ynh2 + ## Captures d'écran