aboutsummaryrefslogtreecommitdiff
path: root/owncloud-dl
diff options
context:
space:
mode:
Diffstat (limited to 'owncloud-dl')
-rwxr-xr-xowncloud-dl64
1 files changed, 64 insertions, 0 deletions
diff --git a/owncloud-dl b/owncloud-dl
new file mode 100755
index 0000000..3ac5a60
--- /dev/null
+++ b/owncloud-dl
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# Owncloud software upgrader.
+# See http://doc.owncloud.org/server/7.0/admin_manual/maintenance/upgrade.html
+#
+
+# Config parameters
+BASENAME="`basename $0`"
+OLD_VERSION="$1"
+VERSION="$2"
+
+# Syntax check
+if [ -z "$2" ]; then
+ echo "usage: $BASENAME <old-version> <new-version>"
+ exit 1
+fi
+
+# Check installed versions
+if [ ! -d "owncloud-$OLD_VERSION" ]; then
+ echo "error: owncloud-$OLD_VERSION is not installed, aborting."
+ exit 1
+elif [ -d "owncloud-$VERSION" ]; then
+ echo "error: owncloud-$VERSION already installed, aborting."
+ exit 1
+fi
+
+# Download package
+wget https://download.owncloud.org/community/owncloud-$VERSION.tar.bz2
+
+# Decompress
+(
+ mkdir tmp
+ cd tmp
+ tar xvf ../owncloud-$VERSION.tar.bz2
+ mv owncloud ../owncloud-$VERSION
+ cd ..
+ rmdir tmp
+)
+
+# Remove package
+rm owncloud-$VERSION.tar.bz2
+
+# Sync configuration
+chown -R root. owncloud-$VERSION
+rsync -av owncloud-$OLD_VERSION/config/ owncloud-$VERSION/config/
+
+# Symlink to contrib content
+(
+ cd owncloud-$VERSION
+ ln -s ../contrib
+ rm -rf themes
+ ln -s contrib/themes
+)
+
+# Pivot
+rm owncloud && ln -s owncloud-$VERSION owncloud
+
+# Audit
+echo "Audit:" && \
+du -hs owncloud-$OLD_VERSION && \
+du -hs owncloud-$VERSION
+
+# Finish
+echo "Please fix config.php manually."