From bce99f4684806612f64475bfb023e970596c8f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Fri, 31 Oct 2025 17:17:40 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20nextcloud:=20script=20style=20and?= =?UTF-8?q?=20retrying?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/nextcloud-appimage-launch | 41 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/bin/nextcloud-appimage-launch b/bin/nextcloud-appimage-launch index 37ce432..7a11e74 100755 --- a/bin/nextcloud-appimage-launch +++ b/bin/nextcloud-appimage-launch @@ -13,33 +13,40 @@ THISDIR="$(dirname "$(readlink -f "${0}")")" needs_commands "curl" "notify-send" version_available="$( \ - curl -sSv 'https://github.com/nextcloud-releases/desktop/releases/latest' 2>&1 \ + curl --silent --verbose --retry-all-errors --retry-delay 3 --retry 5 \ + 'https://github.com/nextcloud-releases/desktop/releases/latest' 2>&1 \ | grep '^< location: ' \ | grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' \ | head -n1 \ )" +if [ -z "${version_available}" ]; then + echo "failed checking for nextcloud update" >&2 + exit 1 +fi + 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!" +if [ "${version_available}" == "${version_installed}" ]; then + echo "nextcloud is up to date!" >&2 + exit 0 fi +echo "new nextcloud version available: ${version_available}" >&2 +notify-send \ + --app-name "Nextcloud" \ + --icon "${THISDIR}/.icon/nextcloud.svg" \ + "nextcloud-appimage-launch" \ + "new nextcloud version available: ${version_available}" + +curl --silent --show-error --fail --location \ + "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" + exec "${INSTALL_DIR}/current" --background "${@}"