diff options
-rwxr-xr-x | nextcloud-dl | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/nextcloud-dl b/nextcloud-dl new file mode 100755 index 0000000..639ac87 --- /dev/null +++ b/nextcloud-dl @@ -0,0 +1,66 @@ +#!/bin/bash +# +# Nextcloud software upgrader. +# See https://docs.nextcloud.com/server/16/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 "nextcloud-$OLD_VERSION" ]; then + echo "error: nextcloud-$OLD_VERSION is not installed, aborting." + exit 1 +elif [ -d "nextcloud-$VERSION" ]; then + echo "error: nextcloud-$VERSION already installed, aborting." + exit 1 +fi + +# Download package +wget -c https://download.nextcloud.com/server/releases/nextcloud-$VERSION.tar.bz2 || exit 1 +wget -c https://download.nextcloud.com/server/releases/nextcloud-$VERSION.tar.bz2.sha256 || exit 1 +sha256sum -c nextcloud-$VERSION.tar.bz2.sha256 || exit -1 + +# Decompress +( + mkdir tmp + cd tmp + tar xvf ../nextcloud-$VERSION.tar.bz2 + mv nextcloud ../nextcloud-$VERSION + cd .. + rmdir tmp +) + +# Remove package +rm nextcloud-$VERSION.tar.bz2 + +# Sync configuration +chown -R root. nextcloud-$VERSION +rsync -av nextcloud-$OLD_VERSION/config/ nextcloud-$VERSION/config/ + +# Symlink to contrib content +#( +# cd nextcloud-$VERSION +# ln -s ../contrib +# rm -rf themes +# ln -s contrib/themes +#) + +# Pivot +rm nextcloud && ln -s nextcloud-$VERSION nextcloud + +# Audit +echo "Audit:" && \ +du -hs nextcloud-$OLD_VERSION && \ +du -hs nextcloud-$VERSION + +# Finish +echo "Please fix config.php manually." |