aboutsummaryrefslogtreecommitdiff
path: root/nextcloud-dl
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2020-10-01 19:22:06 -0300
committerSilvio Rhatto <rhatto@riseup.net>2020-10-01 19:22:06 -0300
commit67f3f58b8b4c163ea0e8fc26df4a977605ff9d34 (patch)
treeabbaca02f3e2b59e05cbded0b9a7f42eaf0b1269 /nextcloud-dl
parent48ef3d069478dab8438db608e2cb3ce10e37c232 (diff)
downloaddownloaders-67f3f58b8b4c163ea0e8fc26df4a977605ff9d34.tar.gz
downloaders-67f3f58b8b4c163ea0e8fc26df4a977605ff9d34.tar.bz2
Adds nextcloud-dl
Diffstat (limited to 'nextcloud-dl')
-rwxr-xr-xnextcloud-dl66
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."