From e23873c5ca582252fcf4482b52488fa08def05c0 Mon Sep 17 00:00:00 2001 From: Dante Date: Tue, 6 Dec 2022 17:51:47 +0000 Subject: [PATCH 1/3] Fix upgrade script after refactor. Always install e2be deps --- scripts/install | 6 +----- scripts/upgrade | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index 415c55f..68abed4 100755 --- a/scripts/install +++ b/scripts/install @@ -160,11 +160,7 @@ mkdir -p /var/log/$app 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-telegram.tar.gz[speedups,qr_login] # metrics,e2be,hq_thumbnails,sqlite,formattednumbers - -if [ $encryption -eq 1 ]; then - $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be] -fi +$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be,speedups,qr_login] # metrics,hq_thumbnails,sqlite,formattednumbers #================================================= # REGISTER SYNAPSE APP-SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index df3fee4..0e4aa19 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,6 +76,27 @@ then ynh_app_setting_set --app=$app --key=appserviceid --value=$appserviceid fi +# If db_name doesn't exist, create it +if [ -z "$db_name" ] +then + db_name=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_name) + ynh_app_setting_set --app=$app --key=db_name --value=$db_name +fi + +# If db_pwd doesn't exist, create it +if [ -z "$db_pwd" ] +then + db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_pwd) + ynh_app_setting_set --app=$app --key=psqlpwd --value=$db_pwd +fi + +# If synapse_registration_path doesn't exist, create it +if [ -z "$synapse_registration_path" ] +then + synapse_registration_path=$(ynh_app_setting_get --app=$app --key=app_service_registration_path) + ynh_app_setting_set --app=$app --key=synapse_registration_path --value=$synapse_registration_path +fi + #================================================= # CREATE DEDICATED USER #================================================= @@ -140,11 +161,7 @@ ynh_script_progression --message="Upgrading Mautrix-Bridge Python Module..." --w 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-telegram.tar.gz[speedups,qr_login] # metrics,e2be,hq_thumbnails,sqlite,formattednumbers - -if [ $encryption -eq 1 ]; then - $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be] -fi +$final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be,speedups,qr_login] # metrics,hq_thumbnails,sqlite,formattednumbers #================================================= # REGISTER SYNAPSE APP-SERVICE From 4846201c24bc9c58833a53c7b6346d705cd455e5 Mon Sep 17 00:00:00 2001 From: Dante Date: Wed, 7 Dec 2022 10:35:23 +0000 Subject: [PATCH 2/3] Bump Yunohost version --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 639ba8a..f53a080 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in A puppeting bridge between Matrix and Telegram packaged as a YunoHost service. Messages, notifications (and sometimes media) are bridged between a Telegram user and a Matrix user. Currently the Matrix user can NOT invite other Matrix user in a bridged Telegram room, so only someone with a Telegram account can participate to Telegram group conversations. The ["Mautrix-Telegram"](https://docs.mau.fi/bridges/python/telegram/index.html) bridge is a Synapse App Service and relies on postgresql. Therefore, [Synapse for YunoHost](https://github.com/YunoHost-Apps/synapse_ynh) should be installed beforehand. -**Shipped version:** 0.12.2~ynh3 +**Shipped version:** 0.12.2~ynh4 ## Disclaimers / important information ## List of known public services diff --git a/README_fr.md b/README_fr.md index c6388a0..1c2e568 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ La passerelle ["Mautrix-Telegram"](https://docs.mau.fi/bridges/python/telegram/i ** Attention : sauvegardez et restaurez toujours les deux applications Yunohost matrix-synapse et mautrix_telegram en même temps!** -**Version incluse :** 0.12.2~ynh3 +**Version incluse :** 0.12.2~ynh4 ## Avertissements / informations importantes ## Liste de passerelles publiques diff --git a/manifest.json b/manifest.json index 25c6a76..f7c5137 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Telegram puppeting bridge for Matrix/Synapse", "fr": "Passerelle Telegram pour Matrix/Synapse" }, - "version": "0.12.2~ynh3", + "version": "0.12.2~ynh4", "url": "https://docs.mau.fi/bridges/python/telegram/index.html", "upstream": { "license": "AGPL-3.0-or-later", From d7f7487c076c3c73bea9e786d7f0e035dca52b91 Mon Sep 17 00:00:00 2001 From: Dante Date: Wed, 7 Dec 2022 11:12:10 +0000 Subject: [PATCH 3/3] Fix db_user var empty on upgrade --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 0e4aa19..09995cc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,6 +80,8 @@ fi if [ -z "$db_name" ] then db_name=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_name) + # db_name and db_user share the same value + db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi