From 42b614310494b89aa1b50bc428712fe4a0ce6208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 29 Feb 2024 08:12:20 +0100 Subject: [PATCH] Avoid to set whole permission on data dir when change-url and config --- scripts/_common.sh | 12 +++++++----- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 9593a96..a06e0b7 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -148,11 +148,13 @@ set_permissions() { chmod 700 $code_dir/update_synapse_for_appservice.sh chmod 700 $code_dir/set_admin_user.sh - find $data_dir \( \! -perm -o= \ - -o \! -user $app \ - -o \! -group $app \) \ - -exec chown $app:$app {} \; \ - -exec chmod o= {} \; + if [ "${1:-}" == data ]; then + find $data_dir \( \! -perm -o= \ + -o \! -user $app \ + -o \! -group $app \) \ + -exec chown $app:$app {} \; \ + -exec chmod o= {} \; + fi chown $app:$app -R /etc/matrix-$app chmod u=rwX,g=rX,o= -R /etc/matrix-$app diff --git a/scripts/install b/scripts/install index 3e4a44b..2d6523d 100644 --- a/scripts/install +++ b/scripts/install @@ -274,7 +274,7 @@ ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update #================================================= ynh_script_progression --message="Protecting directories..." --weight=3 -set_permissions +set_permissions data #================================================= # ADVERTISE SERVICE IN ADMIN PANEL diff --git a/scripts/restore b/scripts/restore index cd8ca47..bd41f6f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -113,7 +113,7 @@ ynh_use_logrotate --logfile /var/log/matrix-$app #================================================= ynh_script_progression --message="Protecting directories..." --weight=3 -set_permissions +set_permissions data #================================================= # RELOAD NGINX, SYNAPSE AND COTURN diff --git a/scripts/upgrade b/scripts/upgrade index dfaee25..b24e6e5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -498,7 +498,7 @@ fi #================================================= ynh_script_progression --message="Protecting directories... (note that it could take a long time depending of your install size)" --weight=3 -set_permissions +set_permissions data #================================================= # UPDATE HOOKS