summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonin Delpeuch <antonin@delpeuch.eu>2023-07-09 22:20:10 +0200
committerGitHub <noreply@github.com>2023-07-09 20:20:10 +0000
commita68c6ef348e605940b1a82d75463062ec0ed8333 (patch)
tree59e9dfc34145e2ece0d71a904b3491c2580e2ede
parent74d33d0020000f3a955e14119f0d7592982e7a31 (diff)
Block upgrade if it is not supported because major versions are too different (#2018)
* Block upgrade if it is not supported Closes #1809. This prevents the install from getting in a state where none of the Docker images will accept running given the contents of the volumes. Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu> * Update docker-entrypoint.sh Co-authored-by: J0WI <J0WI@users.noreply.github.com> Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu> * Update docker-entrypoint.sh Co-authored-by: J0WI <J0WI@users.noreply.github.com> Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu> * Remove extra function Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu> * Update docker-entrypoint.sh Co-authored-by: J0WI <J0WI@users.noreply.github.com> Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu> --------- Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu> Co-authored-by: J0WI <J0WI@users.noreply.github.com>
-rwxr-xr-xdocker-entrypoint.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 941dc3ee..4c85f6ad 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -157,6 +157,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
if version_greater "$image_version" "$installed_version"; then
echo "Initializing nextcloud $image_version ..."
if [ "$installed_version" != "0.0.0.0" ]; then
+ if [ "${image_version%%.*}" -gt "$((${installed_version%%.*} + 1))" ]; then
+ echo "Can't start Nextcloud because upgrading from $installed_version to $image_version is not supported."
+ echo "It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16."
+ exit 1
+ fi
echo "Upgrading nextcloud from $installed_version ..."
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
fi