diff --git a/config_panel.toml b/config_panel.toml index 90a43dd8..3ac84aad 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -25,6 +25,19 @@ name.fr = "Configuration de Nextcloud" help.en = "This action sets permissions for all data. Beware, this action can take up to several hours if users have a lot of data." help.fr = "Cette action définit les autorisations pour toutes les données. Attention, cette action peut prendre jusqu'à plusieurs heures si les utilisateurs ont beaucoup de données." + [main.version] + name.en = "Upgrade channel" + name.fr = "Canal de mise à jour" + + [main.version.version_to_follow] + ask.en = "Upgrade channel to use" + ask.fr = "Canal de mise à jour à utiliser" + type = "select" + choices = ["stable", "oldstable"] + default = "stable" + help.en = "Stable releases (latest Nextcloud version available) sometimes contain annoying bugs or regressions. Using the oldstable channel (one version behind the latest) during this period can be useful if you need high stability." + help.fr = "Les versions stables (dernière version Nextcloud disponible) contiennent parfois des bugs ou des régressions gênants. Utiliser le canal oldstable (une version en retard sur la dernière) pendant cette période peut être utile si vous avez besoin d'une grande stabilité." + [main.addressbook] name.en = "Address book configuration" name.fr = "Configuration du carnet d'adresses" diff --git a/manifest.toml b/manifest.toml index 086012f7..9f141316 100644 --- a/manifest.toml +++ b/manifest.toml @@ -53,6 +53,15 @@ ram.runtime = "512M" type = "boolean" default = false + [install.version_to_follow] + ask.en = "Upgrade channel to use" + ask.fr = "Canal de mise à jour à utiliser" + help.en = "Stable releases (latest Nextcloud version available) sometimes contain annoying bugs or regressions. Using the oldstable channel (one version behind the latest) during this period can be useful if you need high stability." + help.fr = "Les versions stables (dernière version Nextcloud disponible) contiennent parfois des bugs ou des régressions gênants. Utiliser le canal oldstable (une version en retard sur la dernière) pendant cette période peut être utile si vous avez besoin d'une grande stabilité." + type = "select" + choices = ["stable", "oldstable"] + default = "stable" + [resources] [resources.sources] diff --git a/scripts/install b/scripts/install index 4229e7a8..6e260612 100755 --- a/scripts/install +++ b/scripts/install @@ -32,8 +32,15 @@ ynh_script_progression --message="Setting up source files..." --weight=5 # Enable YunoHost patches on Nextcloud sources cp -a ../sources/patches_last_version/* ../sources/patches + +source_id="main" +if [ "$version_to_follow" == "oldstable" ]; then + 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%%.*} + last_major_version=$(( $last_major_version - 1 )) +fi # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir" --source_id="$source_id" #================================================= # PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 1871d924..a4095b73 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,6 +40,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 + + #================================================= # MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR # VERSION TO THE NEXT ONE @@ -126,6 +133,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 - 1 )) + 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 @@ -167,17 +179,19 @@ 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 diff --git a/tests.toml b/tests.toml index 2b893c03..f12c55f3 100644 --- a/tests.toml +++ b/tests.toml @@ -2,6 +2,7 @@ test_format = 1.0 [default] + args.version_to_follow = "stable" args.enable_notify_push = "0" # ------------------------------- @@ -38,8 +39,12 @@ test_format = 1.0 caldav.logged_on_sso = true caldav.expect_content = "This is the WebDAV interface." -#[notify_push_test] - -# args.enable_notify_push = "1" -# test_upgrade_from.e9f82ab7.name = "Upgrade from 28.0.6" -# test_upgrade_from.e9f82ab7.args.system_addressbook_exposed = "yes" +[oldstable] + args.version_to_follow = "oldstable" + test_upgrade_from.e9f82ab7.name = "Upgrade from 28.0.6" + test_upgrade_from.e9f82ab7.args.system_addressbook_exposed = "yes" + +[notify_push_test] + args.enable_notify_push = "1" + test_upgrade_from.e9f82ab7.name = "Upgrade from 28.0.6" + test_upgrade_from.e9f82ab7.args.system_addressbook_exposed = "yes"