From 8d682cbdbcbd1579a9c901f71429dd7354449ae8 Mon Sep 17 00:00:00 2001 From: Kayou Date: Wed, 31 Jul 2024 11:56:49 +0200 Subject: [PATCH] fix find condition --- scripts/install | 12 ++++-------- scripts/restore | 6 ++---- scripts/upgrade | 18 ++++++------------ 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/scripts/install b/scripts/install index 9b705b5..d8ef9c0 100755 --- a/scripts/install +++ b/scripts/install @@ -64,10 +64,8 @@ exec_occ() { } # Set write access for the following commands -find "$install_dir" -not \( -user $app -or -group www-data \) -exec chown $app:www-data {} \+ -chown $app:www-data "$install_dir" -find "$data_dir" -not \( -user $app -or -group $app \) -exec chown $app: {} \+ -chown $app: "$data_dir" +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: {} \+ # Define password in an intermediate var # The fact that it's called _password allows it to be @@ -237,10 +235,8 @@ ynh_multimedia_addaccess $app #================================================= # Fix app ownerships & permissions -find "$install_dir" -not \( -user $app -or -group www-data \) -exec chown $app:www-data {} \+ -chown $app:www-data "$install_dir" -find "$data_dir" -not \( -user $app -or -group $app \) -exec chown $app: {} \+ -chown $app: "$data_dir" +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: {} \+ 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 5ef4f91..6ef7833 100755 --- a/scripts/restore +++ b/scripts/restore @@ -79,10 +79,8 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory #================================================= # Fix app ownerships & permissions -find "$install_dir" -not \( -user $app -or -group www-data \) -exec chown $app:www-data {} \+ -chown $app:www-data "$install_dir" -find "$data_dir" -not \( -user $app -or -group $app \) -exec chown $app: {} \+ -chown $app: "$data_dir" +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: {} \+ 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 76d424b..48a8889 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -138,10 +138,8 @@ then ynh_script_progression --message="Upgrading $app..." --weight=3 # Set write access for the following commands - find "$install_dir" -not \( -user $app -or -group www-data \) -exec chown $app:www-data {} \+ - chown $app:www-data "$install_dir" - find "$data_dir" -not \( -user $app -or -group $app \) -exec chown $app: {} \+ - chown $app: "$data_dir" + 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: {} \+ # Print the current version number of Nextcloud exec_occ -V @@ -210,10 +208,8 @@ then mv "$tmpdir" "$install_dir" # Set write access for the following commands - find "$install_dir" -not \( -user $app -or -group www-data \) -exec chown $app:www-data {} \+ - chown $app:www-data "$install_dir" - find "$data_dir" -not \( -user $app -or -group $app \) -exec chown $app: {} \+ - chown $app: "$data_dir" + 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: {} \+ # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) exec_occ maintenance:mode --off @@ -330,10 +326,8 @@ fi ynh_script_progression --message="Reapplying file permissions..." --weight=2 # Fix app ownerships & permissions -find "$install_dir" -not \( -user $app -or -group www-data \) -exec chown $app:www-data {} \+ -chown $app:www-data "$install_dir" -find "$data_dir" -not \( -user $app -or -group $app \) -exec chown $app: {} \+ -chown $app: "$data_dir" +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: {} \+ 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