From 1949a8c211673f348f55f53f7f85d6908e8d71c8 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:21:39 +0200 Subject: [PATCH 1/3] Update utils --- helpers/helpers.v2.1.d/utils | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/helpers/helpers.v2.1.d/utils b/helpers/helpers.v2.1.d/utils index c7bdfb3217..8072609a3a 100644 --- a/helpers/helpers.v2.1.d/utils +++ b/helpers/helpers.v2.1.d/utils @@ -228,9 +228,14 @@ _ynh_apply_default_permissions() { # App files can have files of their own if ynh_system_user_exists --username="$app"; then # If this is a file in $install_dir or $data_dir : it should be owned and read+writable by $app only - if [ -f "$target" ] && (is_in_dir "$target" "${install_dir:-}" || is_in_dir "$target" "${data_dir:-}" || is_in_dir "$target" "/etc/$app"); then - chmod 600 "$target" - chown "$app:$app" "$target" + if (is_in_dir "$target" "${install_dir:-}" || is_in_dir "$target" "${data_dir:-}" || is_in_dir "$target" "/etc/$app"); then + if [ -d "$target" ]; then + chmod -R o+rwX "$target" + chown -R "$app:$app" "$target" + else + chmod 600 "$target" + chown "$app:$app" "$target" + fi return fi # If this is the install dir (so far this is the only way this helper is called with a directory - along with $data_dir via ynh_restore?) From e486d127e2d4b98b0ecda12d610a61d06960f370 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:26:23 +0200 Subject: [PATCH 2/3] Update sources --- helpers/helpers.v2.1.d/sources | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/helpers/helpers.v2.1.d/sources b/helpers/helpers.v2.1.d/sources index 2ee1ba327a..fae7aba2c9 100644 --- a/helpers/helpers.v2.1.d/sources +++ b/helpers/helpers.v2.1.d/sources @@ -247,7 +247,5 @@ ynh_setup_source() { fi rm -rf /var/cache/yunohost/files_to_keep_during_setup_source/ - if [ -n "${install_dir:-}" ] && [ "$dest_dir" == "$install_dir" ]; then - _ynh_apply_default_permissions $dest_dir - fi + _ynh_apply_default_permissions $dest_dir } From 5f9dc93d90ab39a4a65af27300ae95dad66a9f61 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Tue, 15 Oct 2024 12:50:46 +0200 Subject: [PATCH 3/3] facepalm --- helpers/helpers.v2.1.d/utils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/helpers.v2.1.d/utils b/helpers/helpers.v2.1.d/utils index 8072609a3a..d171f70a30 100644 --- a/helpers/helpers.v2.1.d/utils +++ b/helpers/helpers.v2.1.d/utils @@ -230,7 +230,7 @@ _ynh_apply_default_permissions() { # If this is a file in $install_dir or $data_dir : it should be owned and read+writable by $app only if (is_in_dir "$target" "${install_dir:-}" || is_in_dir "$target" "${data_dir:-}" || is_in_dir "$target" "/etc/$app"); then if [ -d "$target" ]; then - chmod -R o+rwX "$target" + chmod -R u+rwX "$target" chown -R "$app:$app" "$target" else chmod 600 "$target"