45 lines
1.5 KiB
Bash
Executable file
45 lines
1.5 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
INSTALL_DIR="/home/jmm/opt/apps/nextcloud-client"
|
|
|
|
# name: nextcloud-appimage-launch
|
|
# summary: Downloads and launches the latest Nextcloud (desktop) AppImage
|
|
# params: none
|
|
|
|
THISDIR="$(dirname "$(readlink -f "${0}")")"
|
|
# shellcheck disable=SC1091
|
|
. "${THISDIR}/.inc/common"
|
|
|
|
needs_commands "curl" "notify-send"
|
|
|
|
version_available="$( \
|
|
curl -sSv 'https://github.com/nextcloud-releases/desktop/releases/latest' 2>&1 \
|
|
| grep '^< location: ' \
|
|
| grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' \
|
|
| head -n1 \
|
|
)"
|
|
|
|
version_installed="$( \
|
|
readlink "${INSTALL_DIR}/current" \
|
|
| grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' \
|
|
)"
|
|
|
|
if [ -n "${version_available}" ] && [ "${version_available}" != "${version_installed}" ]; then
|
|
echo "new nextcloud version available: ${version_available}"
|
|
notify-send \
|
|
--app-name "Nextcloud" \
|
|
--icon "${THISDIR}/.icon/nextcloud.svg" \
|
|
"nextcloud-appimage-launch" \
|
|
"new nextcloud version available: ${version_available}"
|
|
|
|
curl -sSfL \
|
|
"https://github.com/nextcloud-releases/desktop/releases/download/v${version_available}/Nextcloud-${version_available}-x86_64.AppImage" \
|
|
--output "${INSTALL_DIR}/Nextcloud-${version_available}-x86_64.AppImage"
|
|
|
|
chmod +x "${INSTALL_DIR}/Nextcloud-${version_available}-x86_64.AppImage"
|
|
ln -sf "./Nextcloud-${version_available}-x86_64.AppImage" "${INSTALL_DIR}/current"
|
|
else
|
|
echo "nextcloud is up to date!"
|
|
fi
|
|
|
|
exec "${INSTALL_DIR}/current" --background "${@}"
|