From 292af692cc15a134d4e25824fb19f0ac96a541e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 15 Dec 2017 23:14:04 +0100 Subject: [PATCH] Fix Permission on restore --- scripts/_common.sh | 16 +++++++++------- scripts/install | 1 + scripts/restore | 3 +++ scripts/upgrade | 2 ++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c376291..88f2bfe 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -30,6 +30,15 @@ setup_dir() { mkdir -p $final_path } +set_permission() { + # Set permission + chown $synapse_user:root -R $final_path + chown $synapse_user:root -R /var/lib/matrix-synapse + chown $synapse_user:root -R /var/log/matrix-synapse + chown turnserver:root -R /var/log/turnserver + chown $synapse_user:root -R /etc/matrix-synapse +} + install_source() { if [ -n "$(uname -m | grep arm)" ] then @@ -49,13 +58,6 @@ install_source() { pip install --upgrade https://github.com/matrix-org/synapse/archive/v$APP_VERSION.tar.gz deactivate fi - - # Set permission - chown $synapse_user:root -R $final_path - chown $synapse_user:root -R /var/lib/matrix-synapse - chown $synapse_user:root -R /var/log/matrix-synapse - chown turnserver:root -R /var/log/turnserver - chown $synapse_user:root -R /etc/matrix-synapse } config_nginx() { diff --git a/scripts/install b/scripts/install index bc812d6..50f6f83 100644 --- a/scripts/install +++ b/scripts/install @@ -64,6 +64,7 @@ ynh_psql_execute_as_root \ # Create directory and Install synapse in virtualenv setup_dir install_source +set_permission # Open access to server without a button the home cp ../conf/add_sso_conf.py $final_path diff --git a/scripts/restore b/scripts/restore index 639db50..db1a43b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -40,6 +40,9 @@ ynh_system_user_create $synapse_user /var/lib/matrix-synapse # Restore all config and data ynh_restore +# Set the permission +set_permission + # Open access to server without a button the home python $final_path/add_sso_conf.py diff --git a/scripts/upgrade b/scripts/upgrade index 9b2e8ba..4de3512 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -67,6 +67,7 @@ then # Create directory Install synapse in virtualenv setup_dir || true # If the dir aready exist the command could fail install_source + set_permission # Open access to server without a button the home cp ../conf/add_sso_conf.py $final_path @@ -123,6 +124,7 @@ test -e /var/log/turnserver || (mkdir -p /var/log/turnserver && ynh_use_logrotat # Upgrade manually Synapse install_source +set_permission # Update nginx config config_nginx