From 98c9fc53f14072f8e9405707c5f04a56bb78a2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 21 Feb 2024 22:13:01 +0100 Subject: [PATCH] Fix upgrade --- scripts/upgrade | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index d5adc04..8e5f356 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -311,6 +311,8 @@ if ynh_psql_execute_as_root --sql='\list' | grep matrix_$app; then ynh_psql_execute_as_root --database=$db_name --sql="REASSIGN OWNED BY matrix_$app TO $db_user;" ynh_psql_execute_as_root --sql="UPDATE pg_database SET datcollate='C', datctype='C' WHERE datname='$db_name';" ynh_psql_execute_as_root --sql="DROP USER matrix_$app;" + # for unknown reason we need to set again the password for synapse user. Without this synapse can't authenticate to postgresql + ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH ENCRYPTED PASSWORD '$db_pwd';" fi #================================================= @@ -328,7 +330,7 @@ fi ynh_app_setting_set --app=$app --key=path --value=/ -if yunohost app map -r --output-as json | jq '."'$domain'" | .[] | .id' | grep -v "$app" -q; then +if yunohost app map -r --output-as json | jq -r '."'$domain'" | select( . != null ) | .[] | .id' | grep -v "$app" -q; then ynh_print_warn 'An other app is installed on this domain. Now synapse require to be alone on the domain.' ynh_print_warn 'To solve this you can:' ynh_print_warn "- Remove or move all other app which use '$domain'" @@ -340,6 +342,9 @@ fi #================================================= if grep -q "^matrix-$app" /etc/passwd; then + # Must stop php before remove user as user is used by php + systemctl stop php$YNH_PHP_VERSION-fpm.service + ynh_system_user_delete --username=matrix-$app yunohost user delete $app || true ynh_system_user_create --username=$app --home_dir=$code_dir