From b5e5d83a401d4e7ebd2bf3c11a1771f7745e4408 Mon Sep 17 00:00:00 2001 From: ljf Date: Thu, 22 Aug 2024 16:47:13 +0200 Subject: [PATCH] [enh] oldstable support for upgrade --- config_panel.toml | 11 ++++++++++- scripts/upgrade | 21 ++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index e5e88ae..8fd00c7 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -15,6 +15,15 @@ name = "Nextcloud configuration" 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.version] + [main.version.version_to_follow] + ask.en = "Upgrade channel to use" + type = "select" + choices = ["stable", "oldstable"] + default = "stable" + help.en = "Recent major releases contains sometimes some annoying bugs or regressions. Using the oldstable channel during this period can be useful if you need high stability." + [main.addressbook] name = "Address book configuration" @@ -24,7 +33,7 @@ name = "Nextcloud configuration" type = "boolean" yes = "yes" no = "no" - + [main.php_fpm_config] name = "PHP-FPM configuration" diff --git a/scripts/upgrade b/scripts/upgrade index c4b764c..25be390 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,6 +35,13 @@ then ynh_die --message="Upgrading from Nextcloud < 22.2 is not supported anymore. You should first upgrade to 22.2 using: yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/41f5f902e7c7cd3c30a6793020562ba98b9bf3e9" fi +if [ -z "${version_to_follow:-}" ] +then + version_to_follow=stable + ynh_app_setting_set --app=$app --key=version_to_follow --value="$version_to_follow" +fi + + #================================================= # SPECIFIC UPGRADE #================================================= @@ -123,6 +130,11 @@ current_major_version=${current_version%%.*} last_version=$(ynh_read_manifest --manifest_key="resources.sources.main.url" | grep -o '[0-9][0-9]\.[0-9]\.[0-9]') last_major_version=${last_version%%.*} +if [[ "$version_to_follow" == "oldstable" ]] +then + last_major_version=$((last_major_version--)) + last_version=$(ynh_read_manifest --manifest_key="resources.sources.${last_major_version}.url" | grep -o '[0-9][0-9]\.[0-9]\.[0-9]') +fi if [[ "$last_major_version" != "$current_major_version" ]] then @@ -164,17 +176,20 @@ then fi # While the current version is not the last version, do an upgrade - while [ "$last_version" != "$current_version" ] + while [ "$last_version" > "$current_version" ] do next_major_version="$(( $current_major_version + 1 ))" + source_id="$next_major_version" if [[ "$next_major_version" -ge "$last_major_version" ]]; then ynh_print_info --message="Upgrading to Nextcloud $last_version" cp -a ../sources/patches_last_version/* ../sources/patches - source_id="main" + if [[ "$version_to_follow" != "oldstable" ]] + then + source_id="main" + fi else ynh_print_info --message="Upgrading to Nextcloud $next_major_version" - source_id="$next_major_version" fi # Create a temporary directory