mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Merge pull request #647 from YunoHost-Apps/check-app-compatibility-before-upgrade
Upgrade script: check that installed apps are compatible with the future version before actually starting the upgrade
This commit is contained in:
commit
7e2bbc482b
2 changed files with 36 additions and 0 deletions
3
doc/PRE_UPGRADE.md
Normal file
3
doc/PRE_UPGRADE.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
If you are upgrading to a new major version of Nextcloud, please make sure that your Nextcloud apps are up to date from Nextcloud's administration panel beforehand.
|
||||
|
||||
Additionally, if you installed specific Nextcloud apps, we recommend making sure that they are compatible with the new major version. YunoHost will attempt to check this automatically at the very beginning of the upgrade, but a manual check doesn't hurt either. For Nextcloud 28, this forum thread might be helpful : <https://help.nextcloud.com/t/apps-not-compatible-with-nc-28/176234>.
|
|
@ -81,12 +81,45 @@ local mount_id=$(exec_occ files_external:create --output=json \
|
|||
|| exec_occ files_external:option "$mount_id" enable_sharing true
|
||||
}
|
||||
|
||||
function list_installed_apps_not_compatible_with_future_version()
|
||||
{
|
||||
local nextcloud_destination_version="$1"
|
||||
local nextcloud_current_version="$(grep OC_VersionString "$install_dir/version.php" | cut -d\' -f2)"
|
||||
local installed_apps=$(mktemp)
|
||||
local core_apps_in_current_version=$(mktemp)
|
||||
local nextcloud_destination_appcatalog=$(mktemp)
|
||||
|
||||
# Run a first "dummy" command just to make sure we have the appropriate php dependencies installed,
|
||||
# otherwise this creates funky stuff when tweaking the apt deps because the next command is piped into jq ...
|
||||
exec_occ -V >/dev/null
|
||||
# List installed apps
|
||||
exec_occ app:list --output json | jq -r ".enabled | keys[]" | sort > $installed_apps
|
||||
# Fetch Nextcloud list of core apps from their github repo for the current version
|
||||
curl -s https://raw.githubusercontent.com/nextcloud/server/v$nextcloud_current_version/core/shipped.json | jq -r '.shippedApps[]' | sort > $core_apps_in_current_version
|
||||
# Fetch Nextcloud app catalog (doesnt contain core app) for the future version
|
||||
curl -s https://apps.nextcloud.com/api/v1/platform/$nextcloud_destination_version.0.0/apps.json | jq -r '.[] | .id' | sort > $nextcloud_destination_appcatalog
|
||||
|
||||
# Compute set complement, cf https://catonmat.net/set-operations-in-unix-shell
|
||||
# We want to list the installed apps which are neither core apps nor in the destination catalog
|
||||
comm -23 <(comm -23 $installed_apps $core_apps_in_current_version) $nextcloud_destination_appcatalog
|
||||
}
|
||||
|
||||
|
||||
current_version=$(grep OC_VersionString "$install_dir/version.php" | cut -d\' -f2)
|
||||
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 [[ "$last_major_version" != "$current_major_version" ]]
|
||||
then
|
||||
installed_apps_not_compatible_with_future_version="$(list_installed_apps_not_compatible_with_future_version $last_major_version)"
|
||||
if [[ -n "$installed_apps_not_compatible_with_future_version" ]]
|
||||
then
|
||||
ynh_die --message="The following apps are not (yet?) compatible with Nextcloud $last_major_version. You should make sure to upgrade the app, or disable it, or wait for it to become compatible before running this upgrade : $installed_apps_not_compatible_with_future_version"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading Nextcloud..." --weight=3
|
||||
|
|
Loading…
Add table
Reference in a new issue