1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-21 03:02:09 +00:00

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

This commit is contained in:
Michael Kroes 2016-07-29 17:46:33 +02:00
parent f1ec1eb399
commit abe6bc743f

View File

@ -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