From f6c7f77c0f96098981bb68b873e5722063987821 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Mon, 13 Jan 2020 12:18:16 -0500 Subject: [PATCH] matrixsynapse: Allow upgrade to 1.8.* - Use new configuration from package. - Re-run the post-install to set our custom config. - Re-apply setting for public registration if enabled. Tested by manually downgrading matrix-synapse to 1.6.1-1 and then running apt update. Fixes #1754. Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- plinth/modules/matrixsynapse/__init__.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plinth/modules/matrixsynapse/__init__.py b/plinth/modules/matrixsynapse/__init__.py index f9ebbcee6..9f0c05a6b 100644 --- a/plinth/modules/matrixsynapse/__init__.py +++ b/plinth/modules/matrixsynapse/__init__.py @@ -33,6 +33,7 @@ from plinth.daemon import Daemon from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall from plinth.modules.letsencrypt.components import LetsEncrypt +from plinth.utils import Version from .manifest import backup, clients # noqa, pylint: disable=unused-import @@ -141,6 +142,26 @@ def setup(helper, old_version=None): app.get_component('letsencrypt-matrixsynapse').setup_certificates() +def force_upgrade(helper, packages): + """Force upgrade matrix-synapse to resolve conffile prompt.""" + if 'matrix-synapse' not in packages: + return False + + # Allow any lower version to upgrade to 1.8.* + package = packages['matrix-synapse'] + if Version(package['new_version']) > Version('1.9~'): + return False + + public_registration_status = get_public_registration_status() + helper.install(['matrix-synapse'], force_configuration='new') + actions.superuser_run('matrixsynapse', ['post-install']) + if public_registration_status: + actions.superuser_run('matrixsynapse', + ['public-registration', 'enable']) + + return True + + def setup_domain(domain_name): """Configure a domain name for matrixsynapse.""" app.get_component('letsencrypt-matrixsynapse').setup_certificates(