From abe6bc743f4d784fb28ccfd8e8344f34b3be2ca9 Mon Sep 17 00:00:00 2001 From: Michael Kroes Date: Fri, 29 Jul 2016 17:46:33 +0200 Subject: [PATCH] When upgrading owncloud from 8.2.3 to 9.1.0 the backup of 8.2.3 was overwritten when going from 9.0 to 9.1 --- setup/owncloud.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/setup/owncloud.sh b/setup/owncloud.sh index 902b0cc6..ef84c6ab 100755 --- a/setup/owncloud.sh +++ b/setup/owncloud.sh @@ -32,15 +32,12 @@ InstallOwncloud() { version=$1 hash=$2 + # Remove the current owncloud + rm -rf /usr/local/lib/owncloud + # Download and verify wget_verify https://download.owncloud.org/community/owncloud-$version.zip $hash /tmp/owncloud.zip - # Clear out the existing ownCloud. - if [ -d /usr/local/lib/owncloud/ ]; then - echo "upgrading ownCloud to $version (backing up existing ownCloud directory to /tmp/owncloud-backup-$$)..." - mv /usr/local/lib/owncloud /tmp/owncloud-backup-$$ - fi - # Extract ownCloud unzip -u -o -q /tmp/owncloud.zip -d /usr/local/lib #either extracts new or replaces current files rm -f /tmp/owncloud.zip @@ -87,13 +84,19 @@ InstallOwncloud() { owncloud_ver=9.1.0 -echo "Checking version" # Check if ownCloud dir exist, and check if version matches owncloud_ver (if either doesn't - install/upgrade) if [ ! -d /usr/local/lib/owncloud/ ] \ || ! grep -q $owncloud_ver /usr/local/lib/owncloud/version.php; then - # If we are upgrading from 8.2.3 we should go to 9.0 first. Owncloud doesn't support skipping minor versions - if grep -q 8.2.3 /usr/local/lib/owncloud/version.php; then + # Backup the existing ownCloud. + if [ -d /usr/local/lib/owncloud/ ]; then + echo "upgrading ownCloud to $owncloud_ver (backing up existing ownCloud directory to /tmp/owncloud-backup-$$ and owncloud db to /tmp/owncloud.db)..." + cp -r /usr/local/lib/owncloud /tmp/owncloud-backup-$$ + cp /home/user-data/owncloud/owncloud.db /tmp + fi + + # If we are upgrading from 8.2.x we should go to 9.0 first. Owncloud doesn't support skipping minor versions + if grep -q "8.2.[0-9]" /usr/local/lib/owncloud/version.php; then echo "We are running version 8.2.3, upgrading to 9.0.2 first" # We need to disable memcached and go with APC, the upgrade and install fails