diff --git a/config_panel.toml b/config_panel.toml index 4e458b6..e5e88ae 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -3,14 +3,19 @@ version = "1.0" [main] name = "Nextcloud configuration" - [main.maintenance_mode] - name = "Maintenance mode" + [main.maintenance] + name = "Maintenance" - [main.maintenance_mode.maintenance_mode] + [main.maintenance.maintenance_mode] ask = "Enable maintenance mode" type = "boolean" default = "0" + [main.maintenance.set_permissions_button] + ask.en = "Set permissions for all data (Can take up to several hours if users have a lot of data)" + type = "button" + style = "success" + [main.addressbook] name = "Address book configuration" diff --git a/scripts/config b/scripts/config index 93ced20..e231009 100644 --- a/scripts/config +++ b/scripts/config @@ -105,6 +105,24 @@ set__fpm_free_footprint() { fi } +#================================================= +# SPECIFIC RUNNERS FOR TOML SHORT KEYS +#================================================= + +function run__set_permissions_button() { + local data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) + ynh_print_info "Set permissions, it may take some time..." + 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 + find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750 + chmod 640 "$install_dir/config/config.php" + chmod 755 /home/yunohost.app + chmod 750 $install_dir +} + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/install b/scripts/install index 88c1c0d..0987b84 100755 --- a/scripts/install +++ b/scripts/install @@ -64,7 +64,8 @@ exec_occ() { } # Set write access for the following commands -chown -R $app: "$install_dir" "$data_dir" +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 @@ -240,7 +241,7 @@ 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 find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750 -chmod 640 "$install_dir/config/config.php" +chmod 600 "$install_dir/config/config.php" chmod 755 /home/yunohost.app chmod 750 $install_dir diff --git a/scripts/restore b/scripts/restore index 1b0f63c..9ae3611 100755 --- a/scripts/restore +++ b/scripts/restore @@ -85,7 +85,7 @@ 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 find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750 -chmod 640 "$install_dir/config/config.php" +chmod 600 "$install_dir/config/config.php" chmod 755 /home/yunohost.app chmod 750 $install_dir diff --git a/scripts/upgrade b/scripts/upgrade index ad0e4c6..c4b764c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -138,7 +138,7 @@ then ynh_script_progression --message="Upgrading $app..." --weight=3 # Set write access for the following commands - chown -R $app: "$install_dir" "$data_dir" + chown -R $app:www-data "$install_dir" # Print the current version number of Nextcloud exec_occ -V @@ -207,7 +207,7 @@ then mv "$tmpdir" "$install_dir" # Set write access for the following commands - chown -R $app: "$install_dir" "$data_dir" + chown -R $app:www-data "$install_dir" # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) exec_occ maintenance:mode --off @@ -325,12 +325,9 @@ ynh_script_progression --message="Reapplying file permissions..." --weight=2 # Fix app ownerships & permissions 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 -find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750 -chmod 640 "$install_dir/config/config.php" +chmod 600 "$install_dir/config/config.php" chmod 755 /home/yunohost.app chmod 750 $install_dir