mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
matrixsynapse: Add post install YAML edits
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
f550c7f68a
commit
044df8352d
@ -21,7 +21,8 @@
|
|||||||
Configuration helper for Matrix-Synapse server.
|
Configuration helper for Matrix-Synapse server.
|
||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
|
||||||
|
from ruamel.yaml import round_trip_dump, round_trip_load
|
||||||
|
|
||||||
from plinth import action_utils
|
from plinth import action_utils
|
||||||
|
|
||||||
@ -31,10 +32,9 @@ def parse_arguments():
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||||
|
|
||||||
# Preseed debconf values before packages are installed.
|
post_install = subparsers.add_parser(
|
||||||
pre_install = subparsers.add_parser(
|
'post-install',
|
||||||
'pre-install',
|
help="Perform post install steps")
|
||||||
help='Preseed debconf values before packages are installed.')
|
|
||||||
|
|
||||||
subparsers.add_parser('enable', help='Enable matrix-synapse service')
|
subparsers.add_parser('enable', help='Enable matrix-synapse service')
|
||||||
subparsers.add_parser('disable', help='Disable matrix-synapse service')
|
subparsers.add_parser('disable', help='Disable matrix-synapse service')
|
||||||
@ -46,11 +46,19 @@ def parse_arguments():
|
|||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def subcommand_pre_install(_):
|
def subcommand_post_install(_):
|
||||||
subprocess.check_output(
|
file_path = "/etc/matrix-synapse/homeserver.yaml"
|
||||||
['debconf-set-selections'],
|
|
||||||
input=b'matrix-synapse matrix-synapse/report-stats boolean ' +
|
with open(file_path) as config_file:
|
||||||
b'false')
|
config = round_trip_load(config_file)
|
||||||
|
|
||||||
|
config["no_tls"] = True
|
||||||
|
config["listeners"][1]["bind_address"] = "127.0.0.1"
|
||||||
|
config["max_upload_size"] = "100M"
|
||||||
|
config["enable_registration"] = True
|
||||||
|
|
||||||
|
with open(file_path, "w") as config_file:
|
||||||
|
round_trip_dump(config, config_file)
|
||||||
|
|
||||||
|
|
||||||
def subcommand_setup(arguments):
|
def subcommand_setup(arguments):
|
||||||
|
|||||||
@ -80,8 +80,6 @@ def init():
|
|||||||
|
|
||||||
def setup(helper, old_version=None):
|
def setup(helper, old_version=None):
|
||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.call('pre', actions.superuser_run, 'matrixsynapse',
|
|
||||||
['pre-install'])
|
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
global service
|
global service
|
||||||
if service is None:
|
if service is None:
|
||||||
@ -90,6 +88,8 @@ def setup(helper, old_version=None):
|
|||||||
ports=['matrix-synapse'],
|
ports=['matrix-synapse'],
|
||||||
is_external=True, is_enabled=is_enabled, enable=enable,
|
is_external=True, is_enabled=is_enabled, enable=enable,
|
||||||
disable=disable)
|
disable=disable)
|
||||||
|
helper.call('post', actions.superuser_run, 'matrixsynapse',
|
||||||
|
['post-install'])
|
||||||
helper.call('post', service.notify_enabled, None, True)
|
helper.call('post', service.notify_enabled, None, True)
|
||||||
helper.call('post', add_shortcut)
|
helper.call('post', add_shortcut)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user