useful-scripts/bin/nextcloud-appimage-launch

51 lines
1.6 KiB
Text
Raw Permalink Normal View History

2025-10-30 23:54:40 +00:00
#!/bin/sh
2025-11-08 16:12:16 +00:00
INSTALL_DIR="/home/jmm/opt/apps/nextcloud-client"
2025-10-30 23:54:40 +00:00
# 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 --silent --verbose --retry-all-errors --retry-delay 3 --retry 5 \
'https://github.com/nextcloud-releases/desktop/releases/latest' 2>&1 \
2025-10-30 23:54:40 +00:00
| grep '^< location: ' \
| grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' \
| head -n1 \
)"
if [ -z "${version_available}" ]; then
echo "failed checking for nextcloud update" >&2
exit 1
fi
2025-10-30 23:54:40 +00:00
version_installed="$( \
readlink "${INSTALL_DIR}/current" \
| grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' \
)"
2025-11-08 16:12:16 +00:00
if [ "${version_available}" != "${version_installed}" ]; then
echo "new nextcloud version available: ${version_available}" >&2
notify-send \
--app-name "nextcloud-appimage-launch" \
--icon "${THISDIR}/.icon/nextcloud.svg" \
"Nextcloud" \
"Installing new Nextcloud version: ${version_available}"
if download_gui \
"https://github.com/nextcloud-releases/desktop/releases/download/v${version_available}/Nextcloud-${version_available}-x86_64.AppImage" \
"${INSTALL_DIR}/Nextcloud-${version_available}-x86_64.AppImage" \
""; then # no sha256
chmod +x "${INSTALL_DIR}/Nextcloud-${version_available}-x86_64.AppImage"
ln -sf "./Nextcloud-${version_available}-x86_64.AppImage" "${INSTALL_DIR}/current"
fi
2025-11-08 16:12:16 +00:00
fi
2025-10-30 23:54:40 +00:00
exec "${INSTALL_DIR}/current" --background "${@}"