nextcloudpi/bin/ncp-check-nc-version
Tobias Knöppler aaf7536943
nc-autoupdate-nc: Fix erroneous update/updated notifications
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
2024-09-24 17:08:10 +02:00

29 lines
752 B
Bash
Executable File

#!/bin/bash
# notify latest available NC version
set -e
source /usr/local/etc/library.sh # sets NCLATESTVER
CURRENT="$(nc_version)"
NEXT_VERSION="$(determine_nc_update_version "${CURRENT}" "${NCLATESTVER?}")"
if [[ -z "$NEXT_VERSION" ]] || [[ "$NEXT_VERSION" == "${CURRENT}" ]]
then
exit 0
fi
NOTIFIED=/var/run/.nc-version-notified
test -e "${NOTIFIED}" && [[ "${NEXT_VERSION}" == "$( cat "${NOTIFIED}" )" ]] && {
echo "Found update from ${CURRENT} to ${NEXT_VERSION}. Already notified"
exit 0
}
if is_more_recent_than "${NEXT_VERSION}" "${CURRENT}"; then
notify_admin \
"Nextcloud update" \
"Update from ${CURRENT} to ${NEXT_VERSION} is available. Update from https://$(get_ip):4443"
echo "${NEXT_VERSION}" > "${NOTIFIED}"
fi