From 67f3f58b8b4c163ea0e8fc26df4a977605ff9d34 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 1 Oct 2020 19:22:06 -0300 Subject: Adds nextcloud-dl --- nextcloud-dl | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 nextcloud-dl (limited to 'nextcloud-dl') 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 " + 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." -- cgit v1.2.3