Nextcloud client updates

On Debian systems, I normally use the AppImage package of the Nextcloud client. But unlike native packages, updating it is cumbersome: download the new binary from Nextcloud’s web site, move it to the destination directory and update the symlink (which I use on startup). And sometimes the Nextcloud client announces an update which isn’t even linked on nextcloud.com yet, so I have to switch to Github manually…

Not anymore! I have put together a script for all of that. Simply put it into the directory with the client binaries and the symlink and enjoy the simplicity. 🙂

#!/bin/bash
set -e
DIR=$(readlink -f $(dirname "$0"))
JSON=$(curl
-s https://api.github.com/repos/nextcloud-releases/desktop/releases/latest | jq
'.assets[] | select(.name | match(".*AppImage$"))')
URL=$(echo "$JSON" | jq -r '.url')
NAME=$(echo "$JSON" | jq -r '.name')
curl -L -H "Accept: application/octet-stream" "$URL" >"$DIR/$NAME"
chmod a+x "$DIR/$NAME"
rm -f "$DIR/current.AppImage"
ln -s "$DIR/$NAME" "$DIR/current.AppImage"