mirror of
https://github.com/YunoHost-Apps/synapse_ynh.git
synced 2024-09-03 20:26:38 +02:00
Upgrade to 0.25.0
This commit is contained in:
parent
2eaf418a5f
commit
22e3aae214
8 changed files with 49 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
SOURCE_URL=https://github.com/Josue-T/synapse_python_build/releases/download/v__APP_VERSION__/matrix-synapse___APP_VERSION__-bin1_armv7l.tar.gz
|
SOURCE_URL=https://github.com/Josue-T/synapse_python_build/releases/download/v__APP_VERSION__/matrix-synapse___APP_VERSION__-bin1_armv7l.tar.gz
|
||||||
SOURCE_SUM=20b6b3b195210aa778a017796a310b4327d8ecbd1b423214e83603aae319957c
|
SOURCE_SUM=e1a1790936d10624faf7bbb51b72924a76a6385fc4ed909629e371b4cdc240bf
|
||||||
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||||
# default: sha256
|
# default: sha256
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"en": "Instant messaging server who use matrix",
|
"en": "Instant messaging server who use matrix",
|
||||||
"fr": "Un serveur de messagerie instantané basé sur matrix"
|
"fr": "Un serveur de messagerie instantané basé sur matrix"
|
||||||
},
|
},
|
||||||
"version": "0.24.1",
|
"version": "0.25.0",
|
||||||
"url": "http://matrix.org",
|
"url": "http://matrix.org",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -16,7 +16,7 @@ get_app_version_from_json() {
|
||||||
APP_VERSION=$(get_app_version_from_json)
|
APP_VERSION=$(get_app_version_from_json)
|
||||||
|
|
||||||
install_dependances() {
|
install_dependances() {
|
||||||
ynh_install_app_dependencies coturn build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libxml2-dev libxslt1-dev python-lxml libjpeg-dev libpq-dev postgresql
|
ynh_install_app_dependencies coturn build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libxml2-dev libxslt1-dev python-lxml libjpeg-dev libpq-dev postgresql acl
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install --upgrade virtualenv
|
pip install --upgrade virtualenv
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ install_dependances
|
||||||
ynh_system_user_create $synapse_user /var/lib/matrix-synapse
|
ynh_system_user_create $synapse_user /var/lib/matrix-synapse
|
||||||
|
|
||||||
# Create postgresql database
|
# Create postgresql database
|
||||||
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_create_user $synapse_db_user $synapse_db_pwd
|
ynh_psql_create_user $synapse_db_user $synapse_db_pwd
|
||||||
ynh_psql_execute_as_root \
|
ynh_psql_execute_as_root \
|
||||||
"CREATE DATABASE $synapse_db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $synapse_db_user;"
|
"CREATE DATABASE $synapse_db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $synapse_db_user;"
|
||||||
|
|
|
@ -50,3 +50,20 @@ ynh_psql_drop_db() {
|
||||||
ynh_psql_drop_user() {
|
ynh_psql_drop_user() {
|
||||||
sudo su -c "dropuser ${1}" - postgres
|
sudo su -c "dropuser ${1}" - postgres
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ynh_psql_test_if_first_run() {
|
||||||
|
if [ -f /etc/yunohost/psql ];
|
||||||
|
then
|
||||||
|
echo "PostgreSQL is already installed, no need to create master password"
|
||||||
|
else
|
||||||
|
local pgsql=$(ynh_string_random)
|
||||||
|
echo "$pgsql" >> /etc/yunohost/psql
|
||||||
|
systemctl start postgresql
|
||||||
|
sudo -u postgres psql -c "ALTER user postgres WITH PASSWORD '${pgsql}'"
|
||||||
|
# we can t use peer since YunoHost create users with nologin
|
||||||
|
sed -i '/local\s*all\s*all\s*peer/i \
|
||||||
|
local all all password' /etc/postgresql/9.4/main/pg_hba.conf
|
||||||
|
systemctl enable postgresql
|
||||||
|
systemctl reload postgresql
|
||||||
|
fi
|
||||||
|
}
|
|
@ -47,6 +47,7 @@ python $final_path/add_sso_conf.py
|
||||||
set_certificat_access
|
set_certificat_access
|
||||||
|
|
||||||
# Restore postgresql database
|
# Restore postgresql database
|
||||||
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_create_user $synapse_db_user $synapse_db_pwd
|
ynh_psql_create_user $synapse_db_user $synapse_db_pwd
|
||||||
ynh_psql_execute_as_root \
|
ynh_psql_execute_as_root \
|
||||||
"CREATE DATABASE $synapse_db_name
|
"CREATE DATABASE $synapse_db_name
|
||||||
|
|
|
@ -34,7 +34,7 @@ ynh_abort_if_errors
|
||||||
if [[ -z $synapse_old_version ]]
|
if [[ -z $synapse_old_version ]]
|
||||||
then
|
then
|
||||||
# To be sure that the migration is sucessfull we check that the old synapse version is compatible with the synapse_port_db script.
|
# To be sure that the migration is sucessfull we check that the old synapse version is compatible with the synapse_port_db script.
|
||||||
if [[ $(dpkg -l | grep -c -E "ii.*matrix-synapse.*0.23") != 1 ]] && [[ $(dpkg -l | grep -c -E "ii.*matrix-synapse.*0.24") != 1 ]]
|
if [[ $(dpkg -l | grep -c -E "ii.*matrix-synapse.*0.25") != 1 ]] && [[ $(dpkg -l | grep -c -E "ii.*matrix-synapse.*0.24") != 1 ]]
|
||||||
then
|
then
|
||||||
systemctl start matrix-synapse.service
|
systemctl start matrix-synapse.service
|
||||||
ynh_die "Update from this synapse version is not available now. You need to wait for the next update."
|
ynh_die "Update from this synapse version is not available now. You need to wait for the next update."
|
||||||
|
|
|
@ -43,6 +43,13 @@ BOOLEAN_COLUMNS = {
|
||||||
"device_lists_outbound_pokes": ["sent"],
|
"device_lists_outbound_pokes": ["sent"],
|
||||||
"users_who_share_rooms": ["share_private"],
|
"users_who_share_rooms": ["share_private"],
|
||||||
"groups": ["is_public"],
|
"groups": ["is_public"],
|
||||||
|
"group_rooms": ["is_public"],
|
||||||
|
"group_users": ["is_public", "is_admin"],
|
||||||
|
"group_summary_rooms": ["is_public"],
|
||||||
|
"group_room_categories": ["is_public"],
|
||||||
|
"group_summary_users": ["is_public"],
|
||||||
|
"group_roles": ["is_public"],
|
||||||
|
"local_group_membership": ["is_publicised", "is_admin"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,7 +326,7 @@ class Porter(object):
|
||||||
backward_chunk = min(row[0] for row in brows) - 1
|
backward_chunk = min(row[0] for row in brows) - 1
|
||||||
|
|
||||||
rows = frows + brows
|
rows = frows + brows
|
||||||
self._convert_rows(table, headers, rows)
|
rows = self._convert_rows(table, headers, rows)
|
||||||
|
|
||||||
def insert(txn):
|
def insert(txn):
|
||||||
self.postgres_store.insert_many_txn(
|
self.postgres_store.insert_many_txn(
|
||||||
|
@ -555,17 +562,29 @@ class Porter(object):
|
||||||
i for i, h in enumerate(headers) if h in bool_col_names
|
i for i, h in enumerate(headers) if h in bool_col_names
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class BadValueException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
def conv(j, col):
|
def conv(j, col):
|
||||||
if j in bool_cols:
|
if j in bool_cols:
|
||||||
return bool(col)
|
return bool(col)
|
||||||
|
elif isinstance(col, basestring) and "\0" in col:
|
||||||
|
logger.warn("DROPPING ROW: NUL value in table %s col %s: %r", table, headers[j], col)
|
||||||
|
raise BadValueException();
|
||||||
return col
|
return col
|
||||||
|
|
||||||
|
outrows = []
|
||||||
for i, row in enumerate(rows):
|
for i, row in enumerate(rows):
|
||||||
rows[i] = tuple(
|
try:
|
||||||
|
outrows.append(tuple(
|
||||||
conv(j, col)
|
conv(j, col)
|
||||||
for j, col in enumerate(row)
|
for j, col in enumerate(row)
|
||||||
if j > 0
|
if j > 0
|
||||||
)
|
))
|
||||||
|
except BadValueException:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return outrows
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _setup_sent_transactions(self):
|
def _setup_sent_transactions(self):
|
||||||
|
@ -593,7 +612,7 @@ class Porter(object):
|
||||||
"select", r,
|
"select", r,
|
||||||
)
|
)
|
||||||
|
|
||||||
self._convert_rows("sent_transactions", headers, rows)
|
rows = self._convert_rows("sent_transactions", headers, rows)
|
||||||
|
|
||||||
inserted_rows = len(rows)
|
inserted_rows = len(rows)
|
||||||
if inserted_rows:
|
if inserted_rows:
|
||||||
|
@ -954,4 +973,3 @@ if __name__ == "__main__":
|
||||||
if end_error_exec_info:
|
if end_error_exec_info:
|
||||||
exc_type, exc_value, exc_traceback = end_error_exec_info
|
exc_type, exc_value, exc_traceback = end_error_exec_info
|
||||||
traceback.print_exception(exc_type, exc_value, exc_traceback)
|
traceback.print_exception(exc_type, exc_value, exc_traceback)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue