From 88cd1ba5b760719ba772beb2153b573a46e59458 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 17 Apr 2024 22:17:59 +0200 Subject: [PATCH] Actually disable in-app backup, do not backup backups nor cache --- conf/scheduler.yaml | 4 ++++ doc/POST_UPGRADE.d/1.7.45~ynh3.md | 5 +++++ scripts/backup | 5 ++++- scripts/install | 7 ++++++- scripts/upgrade | 7 +++++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 conf/scheduler.yaml create mode 100644 doc/POST_UPGRADE.d/1.7.45~ynh3.md diff --git a/conf/scheduler.yaml b/conf/scheduler.yaml new file mode 100644 index 0000000..e5ab333 --- /dev/null +++ b/conf/scheduler.yaml @@ -0,0 +1,4 @@ +status: + cache-purge: disabled + cache-clear: disabled + default-site-backup: disabled diff --git a/doc/POST_UPGRADE.d/1.7.45~ynh3.md b/doc/POST_UPGRADE.d/1.7.45~ynh3.md new file mode 100644 index 0000000..d918037 --- /dev/null +++ b/doc/POST_UPGRADE.d/1.7.45~ynh3.md @@ -0,0 +1,5 @@ +Before v1.7.45~ynh3 of this package, an upstream quirk made the app generate a backup daily, despite the default configuration suggesting it to be disabled. + +Starting this version, if you had not already altered the Scheduler configuration, this is fixed. + +The backups directory is also not backed up by YunoHost anymore, as it was superfluous. diff --git a/scripts/backup b/scripts/backup index d4ae004..9cef39e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -19,7 +19,10 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +# Backup install_dir except backup and cache directory +for f in $(ls "$install_dir" -I backup -I cache); do + ynh_backup --src_path="${install_dir}/$f" +done #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index d8523de..76408f0 100644 --- a/scripts/install +++ b/scripts/install @@ -58,7 +58,12 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_exec_as $app mkdir -p "$install_dir/user/config/plugins/login-ldap" ynh_exec_as $app touch "$install_dir/user/accounts/admin.yaml" -# Setting up config +# Setting up scheduler config +ynh_add_config --template="../conf/scheduler.yaml" --destination="$install_dir/user/config/scheduler.yaml" +chown $app:$app "$install_dir/user/config/scheduler.yaml" +chmod 640 "$install_dir/user/config/scheduler.yaml" + +# Setting up LDAP config ynh_add_config --template="../conf/login-ldap.yaml" --destination="$install_dir/user/config/plugins/login-ldap.yaml" chown $app:$app "$install_dir/user/config/plugins/login-ldap.yaml" chmod 640 "$install_dir/user/config/plugins/login-ldap.yaml" diff --git a/scripts/upgrade b/scripts/upgrade index 06f6a74..251bd6d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,6 +29,13 @@ if [ -z "${with_sftp:-}" ] || [ -z "${password:-}" ]; then ynh_app_setting_set --app=$app --key=password --value=$(ynh_string_random) fi +# Setup the scheduler config if it is missing from user directory +if [ ! -f "$install_dir/user/config/scheduler.yaml" ]; then + ynh_add_config --template="../conf/scheduler.yaml" --destination="$install_dir/user/config/scheduler.yaml" + chown $app:$app "$install_dir/user/config/scheduler.yaml" + chmod 640 "$install_dir/user/config/scheduler.yaml"] +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #=================================================