1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00
This commit is contained in:
Kayou 2024-08-23 09:53:30 +02:00 committed by GitHub
commit 818e26e0b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 49 additions and 5 deletions

View file

@ -16,6 +16,14 @@ name = "Nextcloud configuration"
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"

View file

@ -60,6 +60,13 @@ ram.runtime = "512M"
type = "boolean"
default = true
[install.version_to_follow]
ask.en = "Upgrade channel to use"
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."
type = "select"
choices = ["stable", "oldstable"]
default = "stable"
[resources]
[resources.sources]

View file

@ -23,8 +23,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

View file

@ -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 - 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
@ -164,17 +176,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

View file

@ -2,6 +2,8 @@ test_format = 1.0
[default]
args.version_to_follow = "stable"
# -------------------------------
# Commits to test upgrade from
# -------------------------------
@ -11,3 +13,9 @@ test_format = 1.0
test_upgrade_from.9c6d1eea.name = "Upgrade from 27.1.4"
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"