From 74f3112feaa4ca0778d2532000d04f77eca9c455 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 17 Aug 2020 17:07:34 +0200 Subject: [PATCH] fix upgrade --- scripts/install | 7 ++++++- scripts/upgrade | 27 ++++++++++++++++----------- scripts/upgrade.d/upgrade.last.sh | 9 --------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/scripts/install b/scripts/install index db96c16..6eb8471 100755 --- a/scripts/install +++ b/scripts/install @@ -273,7 +273,12 @@ exec_occ background:cron # POST-INSTALL MAINTENANCE #================================================= -(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") +( + cd $final_path + sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices + sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns + sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n +) #================================================= # CONFIGURE THE HOOK FILE FOR USER CREATE diff --git a/scripts/upgrade b/scripts/upgrade index a6a467b..b793386 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -229,6 +229,8 @@ then source upgrade.d/upgrade.last.sh last_version=$next_version + last_major_version=${last_version%%.*} + # Set write access for the following commands chown -R $app: "$final_path" "$datadir" @@ -240,23 +242,19 @@ then do # The major version is the first part of the version number - # major_version=${next_version%%.*} - major_version=${last_version%%.*} current_major_version=${current_version%%.*} - # Load the value for this version - source upgrade.d/upgrade.$current_major_version.sh - # If the current version has the same major version than the next one, # then it's the last upgrade to do - # We also cover the case where the last version is the first of the current major version series - # (e.g. 19.0.0 is the latest version) - if [[ ("$major_version" -eq "$current_major_version") || ( ("$major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then - current_major_version=last - # Execute the commands dedicated to the last upgrade - last_upgrade_operations + if [ "$last_major_version" -eq "$current_major_version" ]; then + current_major_version=last + # Enable YunoHost patches on Nextcloud sources + cp -a ../sources/patches_last_version/* ../sources/patches fi + # Load the value for this version + source upgrade.d/upgrade.$current_major_version.sh + ynh_print_info --message="Upgrade to nextcloud $next_version" # Create an app.src for this version of nextcloud @@ -311,6 +309,13 @@ then exec_occ -V done + ( + cd $final_path + sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices + sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns + sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n + ) + #================================================= # CONFIGURE NEXTCLOUD #================================================= diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 312ae98..2e73d3d 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -5,12 +5,3 @@ next_version="19.0.1" # Nextcloud tarball checksum sha256 nextcloud_source_sha256="4ef311e00d939915d3a9714cd3a1ad436db9157e04620e4a88c2f427e5e65b2d" - -# This function will only be executed upon applying the last upgrade referenced above -last_upgrade_operations () { - # Patch nextcloud files only for the last version - cp -a ../sources/patches_last_version/* ../sources/patches - - # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") -}