From 706d5071c6f4e04af2050546b563400a4e2649f4 Mon Sep 17 00:00:00 2001 From: Kayou Date: Wed, 31 Jul 2024 14:59:55 +0200 Subject: [PATCH] find ... chmod is not faster, at least avoid to chown -R the data_dir in the upgrade script --- scripts/install | 8 ++++---- scripts/restore | 4 ++-- scripts/upgrade | 9 +++------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index d8ef9c0..2f7b40a 100755 --- a/scripts/install +++ b/scripts/install @@ -64,8 +64,8 @@ exec_occ() { } # Set write access for the following commands -find "$install_dir" -not \( -user $app -and -group www-data \) -exec chown $app:www-data {} \+ -find "$data_dir" -not \( -user $app -and -group $app \) -exec chown $app: {} \+ +chown -R $app:www-data "$install_dir" +chown -R $app: "$data_dir" # Define password in an intermediate var # The fact that it's called _password allows it to be @@ -235,8 +235,8 @@ ynh_multimedia_addaccess $app #================================================= # Fix app ownerships & permissions -find "$install_dir" -not \( -user $app -and -group www-data \) -exec chown $app:www-data {} \+ -find "$data_dir" -not \( -user $app -and -group $app \) -exec chown $app: {} \+ +chown -R $app:www-data "$install_dir" +chown -R $app: "$data_dir" find $install_dir/ -type f -print0 | xargs -r0 chmod 0644 find $install_dir/ -type d -print0 | xargs -r0 chmod 0755 find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640 diff --git a/scripts/restore b/scripts/restore index 6ef7833..1b0f63c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -79,8 +79,8 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory #================================================= # Fix app ownerships & permissions -find "$install_dir" -not \( -user $app -and -group www-data \) -exec chown $app:www-data {} \+ -find "$data_dir" -not \( -user $app -and -group $app \) -exec chown $app: {} \+ +chown -R $app:www-data "$install_dir" +chown -R $app: "$data_dir" find $install_dir/ -type f -print0 | xargs -r0 chmod 0644 find $install_dir/ -type d -print0 | xargs -r0 chmod 0755 find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640 diff --git a/scripts/upgrade b/scripts/upgrade index 48a8889..9fb3157 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -138,8 +138,7 @@ then ynh_script_progression --message="Upgrading $app..." --weight=3 # Set write access for the following commands - find "$install_dir" -not \( -user $app -and -group www-data \) -exec chown $app:www-data {} \+ - find "$data_dir" -not \( -user $app -and -group $app \) -exec chown $app: {} \+ + chown -R $app:www-data "$install_dir" # Print the current version number of Nextcloud exec_occ -V @@ -208,8 +207,7 @@ then mv "$tmpdir" "$install_dir" # Set write access for the following commands - find "$install_dir" -not \( -user $app -and -group www-data \) -exec chown $app:www-data {} \+ - find "$data_dir" -not \( -user $app -and -group $app \) -exec chown $app: {} \+ + chown -R $app:www-data "$install_dir" # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) exec_occ maintenance:mode --off @@ -326,8 +324,7 @@ fi ynh_script_progression --message="Reapplying file permissions..." --weight=2 # Fix app ownerships & permissions -find "$install_dir" -not \( -user $app -and -group www-data \) -exec chown $app:www-data {} \+ -find "$data_dir" -not \( -user $app -and -group $app \) -exec chown $app: {} \+ +chown -R $app:www-data "$install_dir" find $install_dir/ -type f -print0 | xargs -r0 chmod 0644 find $install_dir/ -type d -print0 | xargs -r0 chmod 0755 find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640